package handler import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "youngee_m_api/consts" "youngee_m_api/db" "youngee_m_api/model/http_model" "youngee_m_api/util" ) func WrapGetWithdrawCountHandler(ctx *gin.Context) { handler := newGetWithdrawCountHandler(ctx) BaseRun(handler) } type GetWithdrawCountHandler struct { ctx *gin.Context req *http_model.GetWithdrawCountRequest resp *http_model.CommonResponse } func (g GetWithdrawCountHandler) getContext() *gin.Context { return g.ctx } func (g GetWithdrawCountHandler) getResponse() interface{} { return g.resp } func (g GetWithdrawCountHandler) getRequest() interface{} { return g.req } func (g GetWithdrawCountHandler) run() { data, err := db.GetWithdrawCount(g.ctx) if err != nil { logrus.WithContext(g.ctx).Errorf("[GetWithdrawCountHandler] error GetWithdrawCount, err:%+v", err) util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast) return } g.resp.Data = data g.resp.Status = consts.ErrorSuccess g.resp.Message = "成功查询" } func (g GetWithdrawCountHandler) checkParam() error { return nil } func newGetWithdrawCountHandler(ctx *gin.Context) *GetWithdrawCountHandler { return &GetWithdrawCountHandler{ ctx: ctx, req: http_model.NewGetWithdrawCountRequest(), resp: http_model.NewGetWithdrawCountResponse(), } }