1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- 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 WrapGetServeratioHandler(ctx *gin.Context) {
- handler := newGetServeratioHandler(ctx)
- BaseRun(handler)
- }
- type GetServeratioHandler struct {
- ctx *gin.Context
- req *http_model.GetServeratioRequest
- resp *http_model.CommonResponse
- }
- func (c GetServeratioHandler) getContext() *gin.Context { return c.ctx }
- func (c GetServeratioHandler) getResponse() interface{} { return c.resp }
- func (c GetServeratioHandler) getRequest() interface{} {
- return c.req
- }
- func (c GetServeratioHandler) run() {
- data := http_model.GetServeratioRequest{}
- data = *c.req
- res, err := db.GetServeratio(c.ctx, &data)
- if err != nil {
- logrus.Errorf("[GetServeratioHandler] call GetServeratio err:%+v\n", err)
- util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
- logrus.Info("GetServeratioHandler fail,req:%+v", c.req)
- return
- }
- c.resp.Message = "成功获取服务费率"
- c.resp.Status = consts.ErrorSuccess
- c.resp.Data = res
- }
- func (c GetServeratioHandler) checkParam() error {
- return nil
- }
- func newGetServeratioHandler(ctx *gin.Context) *GetServeratioHandler {
- return &GetServeratioHandler{
- ctx: ctx,
- req: http_model.NewGetServeratioRequest(),
- resp: http_model.NewGetServeratioResponse(),
- }
- }
|