supplier_withdraw_count.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 WrapSupplierWithdrawCountHandler(ctx *gin.Context) {
  8. handler := newSupplierWithdrawCountHandler(ctx)
  9. baseRun(handler)
  10. }
  11. func newSupplierWithdrawCountHandler(ctx *gin.Context) *SupplierWithdrawCountHandler {
  12. return &SupplierWithdrawCountHandler{
  13. req: http_model.NewSupplierWithdrawCountRequest(),
  14. resp: http_model.NewSupplierWithdrawCountResponse(),
  15. ctx: ctx,
  16. }
  17. }
  18. type SupplierWithdrawCountHandler struct {
  19. req *http_model.SupplierWithdrawCountRequest
  20. resp *http_model.CommonResponse
  21. ctx *gin.Context
  22. }
  23. func (h *SupplierWithdrawCountHandler) getRequest() interface{} {
  24. return h.req
  25. }
  26. func (h *SupplierWithdrawCountHandler) getContext() *gin.Context {
  27. return h.ctx
  28. }
  29. func (h *SupplierWithdrawCountHandler) getResponse() interface{} {
  30. return h.resp
  31. }
  32. func (h *SupplierWithdrawCountHandler) run() {
  33. toWithdrawCount, err := service.Supplier.GetSupplierWithdrawCount(h.ctx, h.req)
  34. if err != nil {
  35. h.resp.Status = 40000
  36. h.resp.Message = err.Error()
  37. return
  38. }
  39. h.resp.Status = 20000
  40. h.resp.Message = "ok"
  41. h.resp.Data = toWithdrawCount
  42. }
  43. func (h *SupplierWithdrawCountHandler) checkParam() error {
  44. return nil
  45. }