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 WrapAuthkuaishouHandler(ctx *gin.Context) { handler := newAuthkuaishouHandler(ctx) BaseRun(handler) } type AuthkuaishouHandler struct { ctx *gin.Context req *http_model.AuthkuaishouRequest resp *http_model.CommonResponse } func (c AuthkuaishouHandler) getContext() *gin.Context { return c.ctx } func (c AuthkuaishouHandler) getResponse() interface{} { return c.resp } func (c AuthkuaishouHandler) getRequest() interface{} { return c.req } func (c AuthkuaishouHandler) run() { data := http_model.AuthkuaishouRequest{} data = *c.req err := db.Authkuaishou(c.ctx, &data) if err != nil { logrus.Errorf("[AuthkuaishouHandler] call Authkuaishou err:%+v\n", err) util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "") logrus.Info("AuthkuaishouHandler fail,req:%+v", c.req) return } c.resp.Message = "成功创建授权账号" } func (c AuthkuaishouHandler) checkParam() error { return nil } func newAuthkuaishouHandler(ctx *gin.Context) *AuthkuaishouHandler { return &AuthkuaishouHandler{ ctx: ctx, req: http_model.NewAuthkuaishouRequest(), resp: http_model.NewAuthkuaishouResponse(), } }