localaccept_data.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package handler
  2. import (
  3. "youngee_m_api/consts"
  4. "youngee_m_api/model/http_model"
  5. "youngee_m_api/service"
  6. "youngee_m_api/util"
  7. "github.com/gin-gonic/gin"
  8. "github.com/sirupsen/logrus"
  9. log "github.com/sirupsen/logrus"
  10. )
  11. func WrapLocalAcceptDataHandler(ctx *gin.Context) {
  12. handler := newLocalAcceptDataHandler(ctx)
  13. BaseRun(handler)
  14. }
  15. func newLocalAcceptDataHandler(ctx *gin.Context) *LocalAcceptDataHandler {
  16. return &LocalAcceptDataHandler{
  17. req: http_model.NewLocalAcceptDataRequest(),
  18. resp: http_model.NewLocalAcceptDataResponse(),
  19. ctx: ctx,
  20. }
  21. }
  22. type LocalAcceptDataHandler struct {
  23. req *http_model.LocalAcceptDataRequest
  24. resp *http_model.CommonResponse
  25. ctx *gin.Context
  26. }
  27. func (h *LocalAcceptDataHandler) getRequest() interface{} {
  28. return h.req
  29. }
  30. func (h *LocalAcceptDataHandler) getContext() *gin.Context {
  31. return h.ctx
  32. }
  33. func (h *LocalAcceptDataHandler) getResponse() interface{} {
  34. return h.resp
  35. }
  36. func (h *LocalAcceptDataHandler) run() {
  37. data := http_model.LocalAcceptDataRequest{}
  38. data = *h.req
  39. res, err := service.Data.LocalAcceptData(h.ctx, data)
  40. if err != nil {
  41. logrus.Errorf("[ReviseOpinionHandler] call Create err:%+v\n", err)
  42. util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
  43. log.Info("CreateProject fail,req:%+v", h.req)
  44. return
  45. }
  46. h.resp.Message = "成功通过数据"
  47. h.resp.Data = res
  48. h.resp.Status = consts.ErrorSuccess
  49. }
  50. func (h *LocalAcceptDataHandler) checkParam() error {
  51. return nil
  52. }