package handler import ( "github.com/gin-gonic/gin" "youngee_b_api/model/http_model" "youngee_b_api/service" ) func WrapWithdrawAmountHandler(ctx *gin.Context) { handler := newWithdrawAmountHandler(ctx) baseRun(handler) } func newWithdrawAmountHandler(ctx *gin.Context) *WithdrawAmountHandler { return &WithdrawAmountHandler{ req: http_model.NewWithdrawAmountRequest(), resp: http_model.NewWithdrawAmountResponse(), ctx: ctx, } } type WithdrawAmountHandler struct { req *http_model.WithdrawAmountRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *WithdrawAmountHandler) getRequest() interface{} { return h.req } func (h *WithdrawAmountHandler) getContext() *gin.Context { return h.ctx } func (h *WithdrawAmountHandler) getResponse() interface{} { return h.resp } func (h *WithdrawAmountHandler) run() { amount, err := service.Supplier.GetWithdrawAmount(h.ctx, h.req) if err != nil { h.resp.Status = 40000 h.resp.Message = err.Error() return } h.resp.Data = amount h.resp.Message = "ok" } func (h *WithdrawAmountHandler) checkParam() error { return nil }