UpdateSecTaskLogistics.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package handler
  2. import (
  3. "youngee_b_api/consts"
  4. "youngee_b_api/model/http_model"
  5. "youngee_b_api/service/sectask_service"
  6. "youngee_b_api/util"
  7. "github.com/gin-gonic/gin"
  8. "github.com/sirupsen/logrus"
  9. )
  10. func WrapUpdateSecTaskLogisticsHandler(ctx *gin.Context) {
  11. handler := newUpdateSecTaskLogisticsHandler(ctx)
  12. baseRun(handler)
  13. }
  14. type UpdateSecTaskLogistics struct {
  15. ctx *gin.Context
  16. req *http_model.UpdateSecTaskLogisticsRequest
  17. resp *http_model.CommonResponse
  18. }
  19. func (c UpdateSecTaskLogistics) getContext() *gin.Context {
  20. return c.ctx
  21. }
  22. func (c UpdateSecTaskLogistics) getResponse() interface{} {
  23. return c.resp
  24. }
  25. func (c UpdateSecTaskLogistics) getRequest() interface{} {
  26. return c.req
  27. }
  28. func (c UpdateSecTaskLogistics) run() {
  29. data := http_model.UpdateSecTaskLogisticsRequest{}
  30. data = *c.req
  31. res, err := sectask_service.Logistics.Update(c.ctx, data)
  32. if err != nil {
  33. logrus.Errorf("[UpdateSecTaskLogistics] call UpdateSecTaskLogistics err:%+v\n", err)
  34. util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
  35. logrus.Info("UpdateSecTaskLogistics fail,req:%+v", c.req)
  36. return
  37. }
  38. c.resp.Message = "成功修改发货信息"
  39. c.resp.Data = res
  40. }
  41. func (c UpdateSecTaskLogistics) checkParam() error {
  42. return nil
  43. }
  44. func newUpdateSecTaskLogisticsHandler(ctx *gin.Context) *UpdateSecTaskLogistics {
  45. return &UpdateSecTaskLogistics{
  46. ctx: ctx,
  47. req: http_model.NewUpdateSecTaskLogisticsRequest(),
  48. resp: http_model.NewUpdateSecTaskLogisticsResponse(),
  49. }
  50. }