package handler import ( "youngee_b_api/consts" "youngee_b_api/model/http_model" "youngee_b_api/service" "youngee_b_api/util" "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" ) func WrapShowSProjectHandler(ctx *gin.Context) { handler := newShowSProjectHandler(ctx) baseRun(handler) } func newShowSProjectHandler(ctx *gin.Context) *ShowSProjectHandler { return &ShowSProjectHandler{ req: http_model.NewShowSProjectRequest(), resp: http_model.NewShowSProjectResponse(), ctx: ctx, } } type ShowSProjectHandler struct { req *http_model.ShowSProjectRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *ShowSProjectHandler) getRequest() interface{} { return h.req } func (h *ShowSProjectHandler) getContext() *gin.Context { return h.ctx } func (h *ShowSProjectHandler) getResponse() interface{} { return h.resp } func (h *ShowSProjectHandler) run() { data := http_model.ShowSProjectRequest{} data = *h.req // fmt.Printf("sProjectId %+v", data.SProjectId) res, err := service.SProject.GetSProjectDetail(h.ctx, data.SProjectId) if err != nil { logrus.Errorf("[ShowProjectHandler] call Show err:%+v\n", err) util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "") log.Info("ShowProject fail,req:%+v", h.req) return } h.resp.Message = "成功查询项目" h.resp.Data = res } func (h *ShowSProjectHandler) checkParam() error { return nil }