From b331c9990a0396301e934daffe095f99d62d1c89 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 27 九月 2023 15:58:49 +0800 Subject: [PATCH] 任务获取修改,状态2只返回已开始和已结束的 --- pkg/contextx/contextx.go | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/pkg/contextx/contextx.go b/pkg/contextx/contextx.go index c4350a9..aa450eb 100644 --- a/pkg/contextx/contextx.go +++ b/pkg/contextx/contextx.go @@ -18,6 +18,12 @@ Data interface{} `json:"data"` Msg string `json:"msg"` } + ResponseList struct { + Code int `json:"code"` + Data interface{} `json:"data"` + Msg string `json:"msg"` + Total int64 `json:"total"` + } ) func NewContext(ctx *gin.Context, params interface{}) (r *Context, isAllow bool) { @@ -71,6 +77,13 @@ }) } +func (slf *Context) ResultList(data interface{}, total int64) { + slf.ctx.JSON(http.StatusOK, ResponseList{ + Data: data, + Total: total, + }) +} + func (slf *Context) Ok() { slf.Result(ecode.OK, map[string]interface{}{}, "") } @@ -83,6 +96,10 @@ slf.Result(errCode, map[string]interface{}{}, ecode.GetMsg(errCode)) } +func (slf *Context) FailWithMsg(errCode int, msg string) { + slf.Result(errCode, map[string]interface{}{}, msg) +} + func (slf *Context) FailWithDetailed(errCode int, data interface{}) { slf.Result(errCode, data, ecode.GetMsg(errCode)) } -- Gitblit v1.8.0