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 WrapRefuseWithdrawHandler(ctx *gin.Context) { handler := newRefuseWithdrawHandler(ctx) BaseRun(handler) } type RefuseWithdrawHandler struct { ctx *gin.Context req *http_model.RefuseWithdrawRequest resp *http_model.CommonResponse } func (c RefuseWithdrawHandler) getContext() *gin.Context { return c.ctx } func (c RefuseWithdrawHandler) getResponse() interface{} { return c.resp } func (c RefuseWithdrawHandler) getRequest() interface{} { return c.req } func (c RefuseWithdrawHandler) run() { err := db.RefuseWithdraw(c.ctx, c.req) if err != nil { // 数据库查询失败,返回5001 logrus.Errorf("[RefuseWithdrawHandler] call RefuseWithdraw err:%+v\n", err) util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "") logrus.Info("RefuseWithdraw fail,req:%+v", c.req) return } c.resp.Message = "拒绝成功" } func (c RefuseWithdrawHandler) checkParam() error { return nil } func newRefuseWithdrawHandler(ctx *gin.Context) *RefuseWithdrawHandler { return &RefuseWithdrawHandler{ ctx: ctx, req: http_model.NewRefuseWithdrawRequest(), resp: http_model.NewRefuseWithdrawResponse(), } }