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