signForSpecialLogistic.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "youngee_m_api/consts"
  6. "youngee_m_api/model/http_model"
  7. "youngee_m_api/service"
  8. "youngee_m_api/util"
  9. )
  10. func WrapSignForSpecialLogisticHandler(ctx *gin.Context) {
  11. handler := newSignForSpecialLogisticHandler(ctx)
  12. BaseRun(handler)
  13. }
  14. type SignForSpecialLogisticHandler struct {
  15. ctx *gin.Context
  16. req *http_model.SignForSpecialLogisticRequest
  17. resp *http_model.CommonResponse
  18. }
  19. func (s SignForSpecialLogisticHandler) getContext() *gin.Context {
  20. return s.ctx
  21. }
  22. func (s SignForSpecialLogisticHandler) getResponse() interface{} {
  23. return s.resp
  24. }
  25. func (s SignForSpecialLogisticHandler) getRequest() interface{} {
  26. return s.req
  27. }
  28. func (s SignForSpecialLogisticHandler) run() {
  29. data := http_model.SignForSpecialLogisticRequest{}
  30. data = *s.req
  31. err := service.Logistics.SignForSpecialLogistic(s.ctx, data)
  32. if err != nil {
  33. logrus.Errorf("[SignForSpecialLogisticHandler] call Create err:%+v\n", err)
  34. util.HandlerPackErrorResp(s.resp, consts.ErrorInternal, "")
  35. logrus.Info("SignForSpecialLogisticHandler fail,req:%+v", s.req)
  36. return
  37. }
  38. s.resp.Message = "物流状态更换成功"
  39. }
  40. func (s SignForSpecialLogisticHandler) checkParam() error {
  41. return nil
  42. }
  43. func newSignForSpecialLogisticHandler(ctx *gin.Context) *SignForSpecialLogisticHandler {
  44. return &SignForSpecialLogisticHandler{
  45. ctx: ctx,
  46. req: http_model.NewSignForSpecialLogisticRequest(),
  47. resp: http_model.NewSignForSpecialLogisticResponse(),
  48. }
  49. }