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 WrapSubAccountDetailHandler(ctx *gin.Context) { handler := newSubAccountDetail(ctx) BaseRun(handler) } type SubAccountDetailHandler struct { ctx *gin.Context req *http_model.SubAccountDetailRequest resp *http_model.CommonResponse } func (s SubAccountDetailHandler) getContext() *gin.Context { return s.ctx } func (s SubAccountDetailHandler) getResponse() interface{} { return s.resp } func (s SubAccountDetailHandler) getRequest() interface{} { return s.req } func (s SubAccountDetailHandler) run() { //enterpriseID := middleware.GetSessionAuth(s.ctx).EnterpriseID res, err := db.GetSubAccountDetail(s.ctx, s.req) if err != nil { logrus.Errorf("[GetSubAccountDetail] call Show err:%+v\n", err) util.HandlerPackErrorResp(s.resp, consts.ErrorInternal, "") logrus.Info("GetSubAccountDetail fail,req:%+v", s.req) return } s.resp.Data = res } func (s SubAccountDetailHandler) checkParam() error { return nil } func newSubAccountDetail(ctx *gin.Context) *SubAccountDetailHandler { return &SubAccountDetailHandler{ ctx: ctx, req: http_model.NewSubAccountDetailRequest(), resp: http_model.NewSubAccountDetailResponse(), } }