package handler import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "youngee_b_api/consts" "youngee_b_api/model/http_model" "youngee_b_api/pack" "youngee_b_api/service" "youngee_b_api/util" ) func WrapLocalTaskListHandler(ctx *gin.Context) { handler := newLocalTaskListHandler(ctx) baseRun(handler) } func newLocalTaskListHandler(ctx *gin.Context) *LocalTaskListHandler { return &LocalTaskListHandler{ req: http_model.NewLocalTaskListRequest(), resp: http_model.NewLocalTaskListResponse(), ctx: ctx, } } type LocalTaskListHandler struct { req *http_model.LocalTaskListRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *LocalTaskListHandler) getRequest() interface{} { return h.req } func (h *LocalTaskListHandler) getContext() *gin.Context { return h.ctx } func (h *LocalTaskListHandler) getResponse() interface{} { return h.resp } func (h *LocalTaskListHandler) run() { conditions := pack.HttpLocalTaskRequestToCondition(h.req) data, err := service.SLocalLife.GetLocalTaskList(h.ctx, h.req.PageSize, h.req.PageNum, h.req.OrderBy, h.req.OrderDesc, conditions) if err != nil { logrus.WithContext(h.ctx).Errorf("[LocalTaskListHandler] error LocalTaskList, err:%+v", err) util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast) return } h.resp.Status = 20000 h.resp.Message = "ok" h.resp.Data = data } func (h *LocalTaskListHandler) checkParam() error { return nil }