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