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 WrapSetServeratioHandler(ctx *gin.Context) { handler := newSetServeratioHandler(ctx) BaseRun(handler) } type SetServeratioHandler struct { ctx *gin.Context req *http_model.SetServeratioRequest resp *http_model.CommonResponse } func (c SetServeratioHandler) getContext() *gin.Context { return c.ctx } func (c SetServeratioHandler) getResponse() interface{} { return c.resp } func (c SetServeratioHandler) getRequest() interface{} { return c.req } func (c SetServeratioHandler) run() { data := http_model.SetServeratioRequest{} data = *c.req err := db.SetServeratio(c.ctx, &data) if err != nil { logrus.Errorf("[SetServeratioHandler] call SetServeratio err:%+v\n", err) util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "") logrus.Info("SetServeratioHandler fail,req:%+v", c.req) return } c.resp.Message = "成功设置服务费率" } func (c SetServeratioHandler) checkParam() error { return nil } func newSetServeratioHandler(ctx *gin.Context) *SetServeratioHandler { return &SetServeratioHandler{ ctx: ctx, req: http_model.NewSetServeratioRequest(), resp: http_model.NewSetServeratioResponse(), } }