special_local_add_to_list.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "youngee_b_api/model/http_model"
  5. "youngee_b_api/service"
  6. )
  7. func WrapSpecialLocalAddToListHandler(ctx *gin.Context) {
  8. handler := newLocalLifeAddToListHandler(ctx)
  9. baseRun(handler)
  10. }
  11. func newSpecialLocalAddToListHandler(ctx *gin.Context) *SpecialLocalAddToListHandler {
  12. return &SpecialLocalAddToListHandler{
  13. req: http_model.NewSpecialLocalAddToListRequest(),
  14. resp: http_model.NewSpecialLocalAddToListResponse(),
  15. ctx: ctx,
  16. }
  17. }
  18. type SpecialLocalAddToListHandler struct {
  19. req *http_model.SpecialLocalAddToListRequest
  20. resp *http_model.CommonResponse
  21. ctx *gin.Context
  22. }
  23. func (h *SpecialLocalAddToListHandler) getRequest() interface{} {
  24. return h.req
  25. }
  26. func (h *SpecialLocalAddToListHandler) getContext() *gin.Context {
  27. return h.ctx
  28. }
  29. func (h *SpecialLocalAddToListHandler) getResponse() interface{} {
  30. return h.resp
  31. }
  32. func (h *SpecialLocalAddToListHandler) run() {
  33. // 1. 加入商单
  34. createErr := service.SLocalLife.ChangeSupplierStatus(h.ctx, h.req)
  35. if createErr != nil {
  36. h.resp.Status = 50000
  37. h.resp.Message = "加入商单失败"
  38. return
  39. }
  40. h.resp.Status = 20000
  41. h.resp.Message = "加入商单成功"
  42. }
  43. func (h *SpecialLocalAddToListHandler) checkParam() error {
  44. return nil
  45. }