From 550bd8a218224e6c73201f444387d66a299f438b Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 15 八月 2023 19:56:35 +0800
Subject: [PATCH] 消费排程任务存储任务数据,给前端展示任务列表

---
 pkg/contextx/contextx.go |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/pkg/contextx/contextx.go b/pkg/contextx/contextx.go
index c4350a9..5531fe7 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{}{}, "")
 }

--
Gitblit v1.8.0