package handler import ( "youngee_b_api/consts" "youngee_b_api/model/http_model" "youngee_b_api/service" "youngee_b_api/util" "github.com/sirupsen/logrus" "github.com/gin-gonic/gin" ) func WrapLocalTaskCountHandler(ctx *gin.Context) { handler := newLocalTaskCountHandler(ctx) baseRun(handler) } func newLocalTaskCountHandler(ctx *gin.Context) *LocalTaskCountHandler { return &LocalTaskCountHandler{ req: http_model.NewLocalTaskCountRequest(), resp: http_model.NewLocalTaskCountResponse(), ctx: ctx, } } type LocalTaskCountHandler struct { req *http_model.LocalTaskCountRequest resp *http_model.CommonResponse ctx *gin.Context } func (p *LocalTaskCountHandler) getContext() *gin.Context { return p.ctx } func (p *LocalTaskCountHandler) getResponse() interface{} { return p.resp } func (p *LocalTaskCountHandler) getRequest() interface{} { return p.req } func (p *LocalTaskCountHandler) run() { data, err := service.SLocalLife.CountLocalTask(p.ctx, p.req) if err != nil { logrus.Errorf("[ChangeTaskStatusHandler] call Create err:%+v\n", err) util.HandlerPackErrorResp(p.resp, consts.ErrorInternal, "") logrus.Info("ChangeTaskStatus fail,req:%+v", p.req) p.resp.Message = "状态变更失败" p.resp.Status = 40000 return } p.resp.Message = "ok" p.resp.Data = data } func (p *LocalTaskCountHandler) checkParam() error { return nil }