Commit e0ecdb1b authored by chenweijian's avatar chenweijian

Merge remote-tracking branch 'origin/master' into feature/3.5_cwj

parents d19b7c94 cd9c8da7
...@@ -135,3 +135,29 @@ func ResponsePageOk(c *gin.Context, data interface{}, total uint, index int) { ...@@ -135,3 +135,29 @@ func ResponsePageOk(c *gin.Context, data interface{}, total uint, index int) {
traceId, _ := c.Get(mycontext.TRACEID) traceId, _ := c.Get(mycontext.TRACEID)
mylogrus.MyLog.Infof("ResponsePageOk traceId: %s, JSON takes %v", traceId, timeDiff) mylogrus.MyLog.Infof("ResponsePageOk traceId: %s, JSON takes %v", traceId, timeDiff)
} }
type PageRespBase struct {
NextPageIndex int `json:"nextPageIndex"`
HasNextPage bool `json:"hasNextPage"`
Data interface{} `json:"data"` // 需要具体自定义
}
// 分页返回
// 客户端入参 PageReqBase
// 服务端返回 PageRespBase
func ResponsePageBaseOk(c *gin.Context, data interface{}, nextPageIndex int, hasNextPage bool) {
if data == nil {
data = make([]interface{}, 0)
}
response := Response{
Code: myerr.GetSuccessCode(),
Message: myerr.GetSuccessMsg(),
OperationMessage: myerr.GetSuccessMsg(),
Data: PageRespBase{
NextPageIndex: nextPageIndex,
HasNextPage: hasNextPage,
Data: data,
},
}
c.JSON(http.StatusOK, response)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment