UpdateSecTaskLogistics.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 = "ok"
  39. c.resp.Data = res
  40. c.resp.Status = 20000
  41. return
  42. }
  43. func (c UpdateSecTaskLogistics) checkParam() error {
  44. return nil
  45. }
  46. func newUpdateSecTaskLogisticsHandler(ctx *gin.Context) *UpdateSecTaskLogistics {
  47. return &UpdateSecTaskLogistics{
  48. ctx: ctx,
  49. req: http_model.NewUpdateSecTaskLogisticsRequest(),
  50. resp: http_model.NewUpdateSecTaskLogisticsResponse(),
  51. }
  52. }