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 WrapGetRechargeValueHandler(ctx *gin.Context) { handler := newGetRechargeValueHandler(ctx) BaseRun(handler) } type GetRechargeValueHandler struct { ctx *gin.Context req *http_model.GetRechargeValueRequest resp *http_model.CommonResponse } func (g GetRechargeValueHandler) getContext() *gin.Context { return g.ctx } func (g GetRechargeValueHandler) getResponse() interface{} { return g.resp } func (g GetRechargeValueHandler) getRequest() interface{} { return g.req } func (g GetRechargeValueHandler) run() { req := g.req data, err := db.GetRechargeValue(g.ctx, *req) if err != nil { logrus.WithContext(g.ctx).Errorf("[GetRechargeValueHandler] error GetRechargeValue, err:%+v", err) util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast) return } g.resp.Data = data g.resp.Status = consts.ErrorSuccess } func (g GetRechargeValueHandler) checkParam() error { return nil } func newGetRechargeValueHandler(ctx *gin.Context) *GetRechargeValueHandler { return &GetRechargeValueHandler{ ctx: ctx, req: http_model.NewGetRechargeValueRequest(), resp: http_model.NewGetRechargeValueResponse(), } }