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 WrapGetAuthorizationListHandler(ctx *gin.Context) { handler := newGetAuthorizationHandler(ctx) BaseRun(handler) } type GetAuthorizationHandler struct { ctx *gin.Context req *http_model.GetAuthorizationRequest resp *http_model.CommonResponse } func (c GetAuthorizationHandler) getContext() *gin.Context { return c.ctx } func (c GetAuthorizationHandler) getResponse() interface{} { return c.resp } func (c GetAuthorizationHandler) getRequest() interface{} { return c.req } func (c GetAuthorizationHandler) run() { data := http_model.GetAuthorizationRequest{} data = *c.req res, err := db.GetAuthorization(c.ctx, &data) if err != nil { logrus.Errorf("[GetAuthorizationHandler] call GetAuthorization err:%+v\n", err) util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "") logrus.Info("GetAuthorizationHandler fail,req:%+v", c.req) return } c.resp.Message = "成功查询" c.resp.Data = res } func (c GetAuthorizationHandler) checkParam() error { return nil } func newGetAuthorizationHandler(ctx *gin.Context) *GetAuthorizationHandler { return &GetAuthorizationHandler{ ctx: ctx, req: http_model.NewGetAuthorizationRequest(), resp: http_model.NewGetAuthorizationResponse(), } }