Просмотр исходного кода

以下3个接口增加pageflag入参,支持分页从1开始:
通知公告系统消息查询(/Common/QueryNotice)
资金流水查询(当前)(/TaAccount/QueryAmountLog)
资金流水查询(历史)(/TaAccount/QueryHisAmountLog)

zhou.xiaoning 3 лет назад
Родитель
Сommit
0a73d12b41

+ 11 - 2
controllers/common/notice.go

@@ -35,6 +35,7 @@ type QueryNoticeRsp struct {
 // @Security ApiKeyAuth
 // @Param    page       query    int  false "页码"
 // @Param    pagesize   query    int  false "每页条数"
+// @Param    pageflag   query    int  false "分页标志 0-page从0开始 1-page从1开始"
 // @Param    loginID    query    int  true  "登录账号"
 // @Param    msgType    query    int  false "消息类型 - 1:公告通知 2:系统消息"
 // @Param    onlyUnRead query    bool false "是否只获取未读信息"
@@ -141,9 +142,17 @@ func QueryNotice(c *gin.Context) {
 	// 分页
 	total := len(rst)
 	if req.PageSize > 0 {
-		rstByPage := make([]QueryNoticeRsp, 0)
+		var rstByPage []QueryNoticeRsp
 		// 开始上标
-		start := req.Page * req.PageSize
+		// 终端分页1开始
+		p := req.Page
+		if req.PageFlag != 0 {
+			p -= 1
+			if p < 0 {
+				p = 0
+			}
+		}
+		start := p * req.PageSize
 		// 结束下标
 		end := start + req.PageSize
 

+ 20 - 4
controllers/taaccount/taaccount.go

@@ -131,6 +131,7 @@ type QueryAmountLogRsp struct {
 // @Security ApiKeyAuth
 // @Param    page        query    int    false "页码"
 // @Param    pagesize    query    int    false "每页条数"
+// @Param    pageflag    query    int    false "分页标志 0-page从0开始 1-page从1开始"
 // @Param    accountID   query    string true  "资金账户 - 格式:1,2,3"
 // @Param    OperateType query    string false "资金操作类型 - 格式:1,2,3"
 // @Success  200         {object} QueryAmountLogRsp
@@ -178,10 +179,17 @@ func QueryAmountLog(c *gin.Context) {
 	// 查询成功返回
 	if req.PageSize > 0 {
 		// 分页
-		rst := make([]QueryAmountLogRsp, 0)
+		var rst []QueryAmountLogRsp
 		// 开始上标
 		// 终端分页1开始
-		start := (req.Page - 1) * req.PageSize
+		p := req.Page
+		if req.PageFlag != 0 {
+			p -= 1
+			if p < 0 {
+				p = 0
+			}
+		}
+		start := p * req.PageSize
 		// 结束下标
 		end := start + req.PageSize
 
@@ -234,6 +242,7 @@ type QueryHisAmountLogRsp struct {
 // @Security ApiKeyAuth
 // @Param    page        query    int    false "页码"
 // @Param    pagesize    query    int    false "每页条数"
+// @Param    pageflag    query    int    false "分页标志 0-page从0开始 1-page从1开始"
 // @Param    accountID   query    string true  "资金账户 - 格式:1,2,3"
 // @Param    OperateType query    string false "资金操作类型 - 格式:1,2,3"
 // @Param    startDate   query    string false "开始时间 - 闭区间,格式:yyyy-MM-dd"
@@ -289,10 +298,17 @@ func QueryHisAmountLog(c *gin.Context) {
 	// 查询成功返回
 	if req.PageSize > 0 {
 		// 分页
-		rst := make([]QueryHisAmountLogRsp, 0)
+		var rst []QueryHisAmountLogRsp
 		// 开始上标
 		// 终端分页1开始
-		start := (req.Page - 1) * req.PageSize
+		p := req.Page
+		if req.PageFlag != 0 {
+			p -= 1
+			if p < 0 {
+				p = 0
+			}
+		}
+		start := p * req.PageSize
 		// 结束下标
 		end := start + req.PageSize
 

+ 22 - 0
docs/docs.go

@@ -890,6 +890,12 @@ const docTemplate = `{
                     },
                     {
                         "type": "integer",
+                        "description": "分页标志 0-page从0开始 1-page从1开始",
+                        "name": "pageflag",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "登录账号",
                         "name": "loginID",
                         "in": "query",
@@ -13656,6 +13662,12 @@ const docTemplate = `{
                         "in": "query"
                     },
                     {
+                        "type": "integer",
+                        "description": "分页标志 0-page从0开始 1-page从1开始",
+                        "name": "pageflag",
+                        "in": "query"
+                    },
+                    {
                         "type": "string",
                         "description": "资金账户 - 格式:1,2,3",
                         "name": "accountID",
@@ -13713,6 +13725,12 @@ const docTemplate = `{
                         "in": "query"
                     },
                     {
+                        "type": "integer",
+                        "description": "分页标志 0-page从0开始 1-page从1开始",
+                        "name": "pageflag",
+                        "in": "query"
+                    },
+                    {
                         "type": "string",
                         "description": "资金账户 - 格式:1,2,3",
                         "name": "accountID",
@@ -40098,6 +40116,10 @@ const docTemplate = `{
                 "userid"
             ],
             "properties": {
+                "accountname": {
+                    "description": "被推荐人",
+                    "type": "string"
+                },
                 "buytradelot": {
                     "description": "购买笔数",
                     "type": "integer"

+ 22 - 0
docs/swagger.json

@@ -881,6 +881,12 @@
                     },
                     {
                         "type": "integer",
+                        "description": "分页标志 0-page从0开始 1-page从1开始",
+                        "name": "pageflag",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "登录账号",
                         "name": "loginID",
                         "in": "query",
@@ -13647,6 +13653,12 @@
                         "in": "query"
                     },
                     {
+                        "type": "integer",
+                        "description": "分页标志 0-page从0开始 1-page从1开始",
+                        "name": "pageflag",
+                        "in": "query"
+                    },
+                    {
                         "type": "string",
                         "description": "资金账户 - 格式:1,2,3",
                         "name": "accountID",
@@ -13704,6 +13716,12 @@
                         "in": "query"
                     },
                     {
+                        "type": "integer",
+                        "description": "分页标志 0-page从0开始 1-page从1开始",
+                        "name": "pageflag",
+                        "in": "query"
+                    },
+                    {
                         "type": "string",
                         "description": "资金账户 - 格式:1,2,3",
                         "name": "accountID",
@@ -40089,6 +40107,10 @@
                 "userid"
             ],
             "properties": {
+                "accountname": {
+                    "description": "被推荐人",
+                    "type": "string"
+                },
                 "buytradelot": {
                     "description": "购买笔数",
                     "type": "integer"

+ 15 - 0
docs/swagger.yaml

@@ -16837,6 +16837,9 @@ definitions:
     type: object
   models.THJTradeData:
     properties:
+      accountname:
+        description: 被推荐人
+        type: string
       buytradelot:
         description: 购买笔数
         type: integer
@@ -24349,6 +24352,10 @@ paths:
         in: query
         name: pagesize
         type: integer
+      - description: 分页标志 0-page从0开始 1-page从1开始
+        in: query
+        name: pageflag
+        type: integer
       - description: 登录账号
         in: query
         name: loginID
@@ -32394,6 +32401,10 @@ paths:
         in: query
         name: pagesize
         type: integer
+      - description: 分页标志 0-page从0开始 1-page从1开始
+        in: query
+        name: pageflag
+        type: integer
       - description: 资金账户 - 格式:1,2,3
         in: query
         name: accountID
@@ -32430,6 +32441,10 @@ paths:
         in: query
         name: pagesize
         type: integer
+      - description: 分页标志 0-page从0开始 1-page从1开始
+        in: query
+        name: pageflag
+        type: integer
       - description: 资金账户 - 格式:1,2,3
         in: query
         name: accountID

+ 1 - 0
global/app/request.go

@@ -5,4 +5,5 @@ type PageInfo struct {
 	Page     int `json:"page" form:"page"`         // 页码
 	PageSize int `json:"pagesize" form:"pagesize"` // 每页条数
 	Total    int `json:"total"`                    // 总条数
+	PageFlag int `json:"-" form:"pageflag"`        // 分页标志 0-page从0开始 1-page从1开始
 }

+ 2 - 0
models/ferroalloy.go

@@ -915,6 +915,8 @@ type THJTradeData struct {
 
 	WRSTANDARDNAME string `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 现货商品名称
 
+	ACCOUNTNAME string `json:"accountname" xorm:"ACCOUNTNAME"` // 被推荐人
+
 	PageEx `xorm:"extends"` // 页码信息
 }