getwithdrawcount.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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/db"
  7. "youngee_m_api/model/http_model"
  8. "youngee_m_api/util"
  9. )
  10. func WrapGetWithdrawCountHandler(ctx *gin.Context) {
  11. handler := newGetWithdrawCountHandler(ctx)
  12. BaseRun(handler)
  13. }
  14. type GetWithdrawCountHandler struct {
  15. ctx *gin.Context
  16. req *http_model.GetWithdrawCountRequest
  17. resp *http_model.CommonResponse
  18. }
  19. func (g GetWithdrawCountHandler) getContext() *gin.Context {
  20. return g.ctx
  21. }
  22. func (g GetWithdrawCountHandler) getResponse() interface{} {
  23. return g.resp
  24. }
  25. func (g GetWithdrawCountHandler) getRequest() interface{} {
  26. return g.req
  27. }
  28. func (g GetWithdrawCountHandler) run() {
  29. data, err := db.GetWithdrawCount(g.ctx)
  30. if err != nil {
  31. logrus.WithContext(g.ctx).Errorf("[GetWithdrawCountHandler] error GetWithdrawCount, err:%+v", err)
  32. util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
  33. return
  34. }
  35. g.resp.Data = data
  36. g.resp.Status = consts.ErrorSuccess
  37. g.resp.Message = "成功查询"
  38. }
  39. func (g GetWithdrawCountHandler) checkParam() error {
  40. return nil
  41. }
  42. func newGetWithdrawCountHandler(ctx *gin.Context) *GetWithdrawCountHandler {
  43. return &GetWithdrawCountHandler{
  44. ctx: ctx,
  45. req: http_model.NewGetWithdrawCountRequest(),
  46. resp: http_model.NewGetWithdrawCountResponse(),
  47. }
  48. }