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 WrapConfirmWithdrawHandler(ctx *gin.Context) { handler := newConfirmWithdrawHandler(ctx) BaseRun(handler) } type ConfirmWithdrawHandler struct { ctx *gin.Context req *http_model.ConfirmWithdrawRequest resp *http_model.CommonResponse } func (c ConfirmWithdrawHandler) getContext() *gin.Context { return c.ctx } func (c ConfirmWithdrawHandler) getResponse() interface{} { return c.resp } func (c ConfirmWithdrawHandler) getRequest() interface{} { return c.req } func (c ConfirmWithdrawHandler) run() { err := db.ConfirmWithdraw(c.ctx, c.req) if err != nil { // 数据库查询失败,返回5001 logrus.Errorf("[ConfirmWithdrawHandler] call ConfirmWithdraw err:%+v\n", err) util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "") logrus.Info("ConfirmWithdraw fail,req:%+v", c.req) return } c.resp.Message = "确认提现成功" } func (c ConfirmWithdrawHandler) checkParam() error { return nil } func newConfirmWithdrawHandler(ctx *gin.Context) *ConfirmWithdrawHandler { return &ConfirmWithdrawHandler{ ctx: ctx, req: http_model.NewConfirmWithdrawRequest(), resp: http_model.NewConfirmWithdrawResponse(), } }