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 WrapJobListHandler(ctx *gin.Context) { handler := newJobListHandler(ctx) BaseRun(handler) } type JobList struct { ctx *gin.Context req *http_model.JobListRequest resp *http_model.CommonResponse } func (c JobList) getContext() *gin.Context { return c.ctx } func (c JobList) getResponse() interface{} { return c.resp } func (c JobList) getRequest() interface{} { return c.req } func (c JobList) run() { data := http_model.JobListRequest{} data = *c.req res, err := db.GetJobList(c.ctx, &data) if err != nil { logrus.Errorf("[JobList] call JobList err:%+v\n", err) util.HandlerPackErrorResp(c.resp, consts.ErrorParamCheck, "") logrus.Info("JobList fail,req:%+v", c.req) return } c.resp.Message = "成功查询岗位" c.resp.Data = res c.resp.Status = consts.ErrorSuccess } func (c JobList) checkParam() error { return nil } func newJobListHandler(ctx *gin.Context) *JobList { return &JobList{ ctx: ctx, req: http_model.NewJobListRequest(), resp: http_model.NewJobListResponse(), } }