Pārlūkot izejas kodu

修改待支付列表

zhou.xiaoning 5 gadi atpakaļ
vecāks
revīzija
356d200e7c
7 mainītis faili ar 212 papildinājumiem un 254 dzēšanām
  1. 14 26
      controllers/hsby/hsby.go
  2. 55 62
      docs/docs.go
  3. 55 62
      docs/swagger.json
  4. 45 50
      docs/swagger.yaml
  5. 33 45
      models/hsby.go
  6. 1 1
      routers/router.go
  7. 9 8
      token/token.go

+ 14 - 26
controllers/hsby/hsby.go

@@ -852,51 +852,39 @@ func GetHsbyMyCount(c *gin.Context) {
 	appG.Response(http.StatusOK, e.SUCCESS, rsp)
 }
 
-// QueryTradePayOrdersReq 待付款信息查询请求参数
-type QueryTradePayOrdersReq struct {
+// QueryMyPayOrdersReq 我的订单中待付款信息查询请求参数
+type QueryMyPayOrdersReq struct {
 	app.PageInfo
-	PayFlag       string `form:"payFlag" binding:"required"`
-	AccountIDs    string `form:"accountIDs"`
-	SellOrderID   int    `form:"sellOrderID"`
-	SellAccountID int    `form:"sellAccountID"`
+	AccountIDs string `form:"accountIDs" binding:"required"`
 }
 
-// QueryTradePayOrders 获取待付款信息
-// @Summary 获取待付款信息
-// @Description 说明:"我的订单-待付款"请传入accountIDs,同时payFlag传入1;"我的闲置-待收款"请传入sellOrderID和sellAccountID,同时payFlag传入1,2。
+// QueryMyPayOrders 我的订单中待付款信息查询
+// @Summary 我的订单中待付款信息查询
 // @Produce json
 // @Security ApiKeyAuth
 // @Param page query int false "页码"
 // @Param pagesize query int false "每页条数"
-// @Param payFlag query string true "付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期,格式:1,2,3"
-// @Param accountIDs query string false "资金账户列表,格式:1,2,3"
-// @Param sellOrderID query int false "卖方委托单号"
-// @Param sellAccountID query int false "卖方账号ID[报价币种]"
+// @Param accountIDs query string true "资金账户列表,格式:1,2,3"
 // @Success 200 {object} models.HsbyBuyMyPayOrder
 // @Failure 500 {object} app.Response
-// @Router /HSBY/QueryTradePayOrders [get]
+// @Router /HSBY/QueryMyPayOrders [get]
 // @Tags 定制【海商报业】
-func QueryTradePayOrders(c *gin.Context) {
+func QueryMyPayOrders(c *gin.Context) {
 	appG := app.Gin{C: c}
 
 	// 获取请求参数
-	var req QueryTradePayOrdersReq
+	var req QueryMyPayOrdersReq
 	if err := appG.C.ShouldBindQuery(&req); err != nil {
-		logger.GetLogger().Errorf("QueryTradePayOrders failed: %s", err.Error())
-		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
-		return
-	}
-	if len(req.AccountIDs) == 0 && (req.SellOrderID == 0 || req.SellAccountID == 0) {
-		logger.GetLogger().Errorf("QueryTradePayOrders failed: 参数错误")
+		logger.GetLogger().Errorf("QueryMyPayOrders failed: %s", err.Error())
 		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
 		return
 	}
 
 	// 获取数据
-	orders, err := models.GetHsbyBuyMyPayOrders(req.AccountIDs, req.PayFlag, req.SellOrderID, req.SellAccountID)
+	orders, err := models.GetHsbyBuyMyPayOrders(req.AccountIDs)
 	if err != nil {
 		// 查询失败
-		logger.GetLogger().Errorf("QueryTradePayOrders failed: %s", err.Error())
+		logger.GetLogger().Errorf("QueryMyPayOrders failed: %s", err.Error())
 		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 		return
 	}
@@ -930,10 +918,10 @@ func QueryTradePayOrders(c *gin.Context) {
 
 	// 查询成功返回
 	if req.PageSize > 0 {
-		logger.GetLogger().Debugln("QueryTradePayOrders successed: %v", orders)
+		logger.GetLogger().Debugln("QueryMyPayOrders successed: %v", orders)
 		appG.ResponseByPage(http.StatusOK, e.SUCCESS, orders, app.PageInfo{Page: req.Page, PageSize: req.PageSize, Total: total})
 	} else {
-		logger.GetLogger().Debugln("QueryTradePayOrders successed: %v", orders)
+		logger.GetLogger().Debugln("QueryMyPayOrders successed: %v", orders)
 		appG.Response(http.StatusOK, e.SUCCESS, orders)
 	}
 }

+ 55 - 62
docs/docs.go

@@ -1918,34 +1918,46 @@ var doc = `{
                 }
             }
         },
-        "/HSBY/QueryProvincesAndCities": {
+        "/HSBY/QueryMyPayOrders": {
             "get": {
                 "security": [
                     {
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "查询结果只包括二级市场商品已关连的省市信息。",
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
                     "定制【海商报业】"
                 ],
-                "summary": "查询省市信息(不包括区)",
+                "summary": "我的订单中待付款信息查询",
                 "parameters": [
                     {
                         "type": "integer",
-                        "description": "省ID",
-                        "name": "provinceID",
+                        "description": "页码",
+                        "name": "page",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "资金账户列表,格式:1,2,3",
+                        "name": "accountIDs",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/hsby.QueryProvincesAndCitiesRsp"
+                            "$ref": "#/definitions/models.HsbyBuyMyPayOrder"
                         }
                     },
                     "500": {
@@ -1957,57 +1969,26 @@ var doc = `{
                 }
             }
         },
-        "/HSBY/QueryTradePayOrders": {
+        "/HSBY/QueryProvincesAndCities": {
             "get": {
                 "security": [
                     {
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "说明:\"我的订单-待付款\"请传入accountIDs,同时payFlag传入1;\"我的闲置-待收款\"请传入sellOrderID和sellAccountID,同时payFlag传入1,2。",
+                "description": "查询结果只包括二级市场商品已关连的省市信息。",
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
                     "定制【海商报业】"
                 ],
-                "summary": "获取待付款信息",
+                "summary": "查询省市信息(不包括区)",
                 "parameters": [
                     {
                         "type": "integer",
-                        "description": "页码",
-                        "name": "page",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "每页条数",
-                        "name": "pagesize",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "description": "付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期,格式:1,2,3",
-                        "name": "payFlag",
-                        "in": "query",
-                        "required": true
-                    },
-                    {
-                        "type": "string",
-                        "description": "资金账户列表,格式:1,2,3",
-                        "name": "accountIDs",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "卖方委托单号",
-                        "name": "sellOrderID",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "卖方账号ID[报价币种]",
-                        "name": "sellAccountID",
+                        "description": "省ID",
+                        "name": "provinceID",
                         "in": "query"
                     }
                 ],
@@ -2015,7 +1996,7 @@ var doc = `{
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/models.HsbyBuyMyPayOrder"
+                            "$ref": "#/definitions/hsby.QueryProvincesAndCitiesRsp"
                         }
                     },
                     "500": {
@@ -6304,32 +6285,24 @@ var doc = `{
         "models.HsbyBuyMyPayOrder": {
             "type": "object",
             "required": [
-                "accountid",
-                "buyorsell",
                 "goodscode",
-                "goodsid",
                 "goodsname",
-                "marketid",
-                "orderid",
+                "tradeid",
                 "trademode"
             ],
             "properties": {
-                "accountid": {
-                    "description": "账户ID[报价币种]",
-                    "type": "integer"
-                },
-                "accountname": {
-                    "description": "购买方名称",
-                    "type": "string"
-                },
                 "agreeunit": {
                     "description": "合约单位",
                     "type": "number"
                 },
-                "buyorsell": {
-                    "description": "买卖 - 0:买 1:卖",
+                "buyaccountid": {
+                    "description": "买方账号ID[报价币种]",
                     "type": "integer"
                 },
+                "buyorderid": {
+                    "description": "买方委托单号",
+                    "type": "string"
+                },
                 "createtime": {
                     "description": "创建时间",
                     "type": "string"
@@ -6362,18 +6335,22 @@ var doc = `{
                     "description": "优惠金额",
                     "type": "number"
                 },
-                "orderid": {
-                    "description": "单号(成交单号)",
-                    "type": "string"
+                "payamount": {
+                    "description": "支付金额 = TradeAmount + TradeCharge - OffAmount",
+                    "type": "number"
                 },
                 "payflag": {
-                    "description": "付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期",
+                    "description": "付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期 6:预售终止",
                     "type": "integer"
                 },
                 "paylimitedtime": {
                     "description": "支付期限",
                     "type": "string"
                 },
+                "paytime": {
+                    "description": "付款时间",
+                    "type": "string"
+                },
                 "picurls1": {
                     "description": "预售商品介绍图片[多张用逗号分隔]",
                     "type": "string"
@@ -6382,6 +6359,14 @@ var doc = `{
                     "description": "挂牌商品介绍图片[多张用逗号分隔]",
                     "type": "string"
                 },
+                "sellaccountid": {
+                    "description": "卖方账号ID[报价币种]",
+                    "type": "integer"
+                },
+                "sellorderid": {
+                    "description": "卖方委托单号",
+                    "type": "string"
+                },
                 "tradeamount": {
                     "description": "成交金额",
                     "type": "number"
@@ -6390,6 +6375,14 @@ var doc = `{
                     "description": "成交手续费(买方)",
                     "type": "number"
                 },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
                 "trademode": {
                     "description": "交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价",
                     "type": "integer"

+ 55 - 62
docs/swagger.json

@@ -1902,34 +1902,46 @@
                 }
             }
         },
-        "/HSBY/QueryProvincesAndCities": {
+        "/HSBY/QueryMyPayOrders": {
             "get": {
                 "security": [
                     {
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "查询结果只包括二级市场商品已关连的省市信息。",
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
                     "定制【海商报业】"
                 ],
-                "summary": "查询省市信息(不包括区)",
+                "summary": "我的订单中待付款信息查询",
                 "parameters": [
                     {
                         "type": "integer",
-                        "description": "省ID",
-                        "name": "provinceID",
+                        "description": "页码",
+                        "name": "page",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "资金账户列表,格式:1,2,3",
+                        "name": "accountIDs",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/hsby.QueryProvincesAndCitiesRsp"
+                            "$ref": "#/definitions/models.HsbyBuyMyPayOrder"
                         }
                     },
                     "500": {
@@ -1941,57 +1953,26 @@
                 }
             }
         },
-        "/HSBY/QueryTradePayOrders": {
+        "/HSBY/QueryProvincesAndCities": {
             "get": {
                 "security": [
                     {
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "说明:\"我的订单-待付款\"请传入accountIDs,同时payFlag传入1;\"我的闲置-待收款\"请传入sellOrderID和sellAccountID,同时payFlag传入1,2。",
+                "description": "查询结果只包括二级市场商品已关连的省市信息。",
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
                     "定制【海商报业】"
                 ],
-                "summary": "获取待付款信息",
+                "summary": "查询省市信息(不包括区)",
                 "parameters": [
                     {
                         "type": "integer",
-                        "description": "页码",
-                        "name": "page",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "每页条数",
-                        "name": "pagesize",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "description": "付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期,格式:1,2,3",
-                        "name": "payFlag",
-                        "in": "query",
-                        "required": true
-                    },
-                    {
-                        "type": "string",
-                        "description": "资金账户列表,格式:1,2,3",
-                        "name": "accountIDs",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "卖方委托单号",
-                        "name": "sellOrderID",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "卖方账号ID[报价币种]",
-                        "name": "sellAccountID",
+                        "description": "省ID",
+                        "name": "provinceID",
                         "in": "query"
                     }
                 ],
@@ -1999,7 +1980,7 @@
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/models.HsbyBuyMyPayOrder"
+                            "$ref": "#/definitions/hsby.QueryProvincesAndCitiesRsp"
                         }
                     },
                     "500": {
@@ -6288,32 +6269,24 @@
         "models.HsbyBuyMyPayOrder": {
             "type": "object",
             "required": [
-                "accountid",
-                "buyorsell",
                 "goodscode",
-                "goodsid",
                 "goodsname",
-                "marketid",
-                "orderid",
+                "tradeid",
                 "trademode"
             ],
             "properties": {
-                "accountid": {
-                    "description": "账户ID[报价币种]",
-                    "type": "integer"
-                },
-                "accountname": {
-                    "description": "购买方名称",
-                    "type": "string"
-                },
                 "agreeunit": {
                     "description": "合约单位",
                     "type": "number"
                 },
-                "buyorsell": {
-                    "description": "买卖 - 0:买 1:卖",
+                "buyaccountid": {
+                    "description": "买方账号ID[报价币种]",
                     "type": "integer"
                 },
+                "buyorderid": {
+                    "description": "买方委托单号",
+                    "type": "string"
+                },
                 "createtime": {
                     "description": "创建时间",
                     "type": "string"
@@ -6346,18 +6319,22 @@
                     "description": "优惠金额",
                     "type": "number"
                 },
-                "orderid": {
-                    "description": "单号(成交单号)",
-                    "type": "string"
+                "payamount": {
+                    "description": "支付金额 = TradeAmount + TradeCharge - OffAmount",
+                    "type": "number"
                 },
                 "payflag": {
-                    "description": "付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期",
+                    "description": "付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期 6:预售终止",
                     "type": "integer"
                 },
                 "paylimitedtime": {
                     "description": "支付期限",
                     "type": "string"
                 },
+                "paytime": {
+                    "description": "付款时间",
+                    "type": "string"
+                },
                 "picurls1": {
                     "description": "预售商品介绍图片[多张用逗号分隔]",
                     "type": "string"
@@ -6366,6 +6343,14 @@
                     "description": "挂牌商品介绍图片[多张用逗号分隔]",
                     "type": "string"
                 },
+                "sellaccountid": {
+                    "description": "卖方账号ID[报价币种]",
+                    "type": "integer"
+                },
+                "sellorderid": {
+                    "description": "卖方委托单号",
+                    "type": "string"
+                },
                 "tradeamount": {
                     "description": "成交金额",
                     "type": "number"
@@ -6374,6 +6359,14 @@
                     "description": "成交手续费(买方)",
                     "type": "number"
                 },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
                 "trademode": {
                     "description": "交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价",
                     "type": "integer"

+ 45 - 50
docs/swagger.yaml

@@ -2113,18 +2113,15 @@ definitions:
     type: object
   models.HsbyBuyMyPayOrder:
     properties:
-      accountid:
-        description: 账户ID[报价币种]
-        type: integer
-      accountname:
-        description: 购买方名称
-        type: string
       agreeunit:
         description: 合约单位
         type: number
-      buyorsell:
-        description: 买卖 - 0:买 1:卖
+      buyaccountid:
+        description: 买方账号ID[报价币种]
         type: integer
+      buyorderid:
+        description: 买方委托单号
+        type: string
       createtime:
         description: 创建时间
         type: string
@@ -2149,27 +2146,42 @@ definitions:
       offamount:
         description: 优惠金额
         type: number
-      orderid:
-        description: 单号(成交单号)
-        type: string
+      payamount:
+        description: 支付金额 = TradeAmount + TradeCharge - OffAmount
+        type: number
       payflag:
-        description: 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期
+        description: 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期 6:预售终止
         type: integer
       paylimitedtime:
         description: 支付期限
         type: string
+      paytime:
+        description: 付款时间
+        type: string
       picurls1:
         description: 预售商品介绍图片[多张用逗号分隔]
         type: string
       picurls2:
         description: 挂牌商品介绍图片[多张用逗号分隔]
         type: string
+      sellaccountid:
+        description: 卖方账号ID[报价币种]
+        type: integer
+      sellorderid:
+        description: 卖方委托单号
+        type: string
       tradeamount:
         description: 成交金额
         type: number
       tradecharge:
         description: 成交手续费(买方)
         type: number
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      tradeid:
+        description: 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+        type: string
       trademode:
         description: 交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式
           21:竞拍-大宗式 22:受托竞价
@@ -2187,13 +2199,9 @@ definitions:
         description: 挂牌商品供应商名称
         type: string
     required:
-    - accountid
-    - buyorsell
     - goodscode
-    - goodsid
     - goodsname
-    - marketid
-    - orderid
+    - tradeid
     - trademode
     type: object
   models.HsbyBuyMyTradeDetail:
@@ -6119,58 +6127,45 @@ paths:
       summary: 查询热卖商品列表(二级市场挂牌点选)
       tags:
       - 定制【海商报业】
-  /HSBY/QueryProvincesAndCities:
+  /HSBY/QueryMyPayOrders:
     get:
-      description: 查询结果只包括二级市场商品已关连的省市信息。
       parameters:
-      - description: 省ID
+      - description: 页码
         in: query
-        name: provinceID
+        name: page
         type: integer
+      - description: 每页条数
+        in: query
+        name: pagesize
+        type: integer
+      - description: 资金账户列表,格式:1,2,3
+        in: query
+        name: accountIDs
+        required: true
+        type: string
       produces:
       - application/json
       responses:
         "200":
           description: OK
           schema:
-            $ref: '#/definitions/hsby.QueryProvincesAndCitiesRsp'
+            $ref: '#/definitions/models.HsbyBuyMyPayOrder'
         "500":
           description: Internal Server Error
           schema:
             $ref: '#/definitions/app.Response'
       security:
       - ApiKeyAuth: []
-      summary: 查询省市信息(不包括区)
+      summary: 我的订单中待付款信息查询
       tags:
       - 定制【海商报业】
-  /HSBY/QueryTradePayOrders:
+  /HSBY/QueryProvincesAndCities:
     get:
-      description: 说明:"我的订单-待付款"请传入accountIDs,同时payFlag传入1;"我的闲置-待收款"请传入sellOrderID和sellAccountID,同时payFlag传入1,2
+      description: 查询结果只包括二级市场商品已关连的省市信息
       parameters:
-      - description: 页码
-        in: query
-        name: page
-        type: integer
-      - description: 每页条数
-        in: query
-        name: pagesize
-        type: integer
-      - description: 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期,格式:1,2,3
-        in: query
-        name: payFlag
-        required: true
-        type: string
-      - description: 资金账户列表,格式:1,2,3
-        in: query
-        name: accountIDs
-        type: string
-      - description: 卖方委托单号
-        in: query
-        name: sellOrderID
-        type: integer
-      - description: 卖方账号ID[报价币种]
+      - description: 省ID
         in: query
-        name: sellAccountID
+        name: provinceID
         type: integer
       produces:
       - application/json
@@ -6178,14 +6173,14 @@ paths:
         "200":
           description: OK
           schema:
-            $ref: '#/definitions/models.HsbyBuyMyPayOrder'
+            $ref: '#/definitions/hsby.QueryProvincesAndCitiesRsp'
         "500":
           description: Internal Server Error
           schema:
             $ref: '#/definitions/app.Response'
       security:
       - ApiKeyAuth: []
-      summary: 获取待付款信息
+      summary: 查询省市信息(不包括区)
       tags:
       - 定制【海商报业】
   /HSBY/SetHsbyMyPackagesStatus:

+ 33 - 45
models/hsby.go

@@ -52,23 +52,24 @@ func (Hsbysupplierinfo) TableName() string {
 
 // Tradepayorder 交易待付款表
 type Tradepayorder struct {
-	Tradeid        string    `json:"tradeid"  xorm:"'TRADEID'" binding:"required"` // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	Tradeid        int64     `json:"tradeid"  xorm:"'TRADEID'" binding:"required"` // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
 	Tradedate      string    `json:"tradedate"  xorm:"'TRADEDATE'"`                // 交易日(yyyyMMdd)
 	Marketid       int32     `json:"marketid"  xorm:"'MARKETID'"`                  // 市场ID
 	Goodsid        int32     `json:"goodsid"  xorm:"'GOODSID'"`                    // 商品ID
-	Buyorderid     string    `json:"buyorderid"  xorm:"'BUYORDERID'"`              // 买方委托单号
+	Buyorderid     int64     `json:"buyorderid"  xorm:"'BUYORDERID'"`              // 买方委托单号
 	Buyaccountid   int64     `json:"buyaccountid"  xorm:"'BUYACCOUNTID'"`          // 买方账号ID[报价币种]
-	Sellorderid    string    `json:"sellorderid"  xorm:"'SELLORDERID'"`            // 卖方委托单号
+	Sellorderid    int64     `json:"sellorderid"  xorm:"'SELLORDERID'"`            // 卖方委托单号
 	Sellaccountid  int64     `json:"sellaccountid"  xorm:"'SELLACCOUNTID'"`        // 卖方账号ID[报价币种]
 	Tradeamount    float64   `json:"tradeamount"  xorm:"'TRADEAMOUNT'"`            // 成交金额
 	Tradecharge    float64   `json:"tradecharge"  xorm:"'TRADECHARGE'"`            // 成交手续费(买方)
-	Payflag        int32     `json:"payflag"  xorm:"'PAYFLAG'"`                    // 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期
+	Payflag        int32     `json:"payflag"  xorm:"'PAYFLAG'"`                    // 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期 6:预售终止
 	Createtime     time.Time `json:"createtime"  xorm:"'CREATETIME'"`              // 创建时间
 	Paytime        time.Time `json:"paytime"  xorm:"'PAYTIME'"`                    // 付款时间
 	Paylimitedtime time.Time `json:"paylimitedtime"  xorm:"'PAYLIMITEDTIME'"`      // 支付期限
 	Offamount      float64   `json:"offamount"  xorm:"'OFFAMOUNT'"`                // 优惠金额
 	Tradeprice     float64   `json:"tradeprice"  xorm:"'TRADEPRICE'"`              // 成交价格
 	Tradeqty       int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`                  // 成交数量
+	Payamount      float64   `json:"payamount"  xorm:"'PAYAMOUNT'"`                // 支付金额 = TradeAmount + TradeCharge - OffAmount
 }
 
 // TableName is TRADE_PAYORDER
@@ -1121,11 +1122,24 @@ func GetHsbyBuyMyTradeDetails(accountIDs string) ([]HsbyBuyMyTradeDetail, error)
 
 // HsbyBuyMyPayOrder "我的订单 - 待付款"单据信息(一二级市场成交单和待付款信息)
 type HsbyBuyMyPayOrder struct {
-	Orderid   string `json:"orderid"  xorm:"'ORDERID'" binding:"required"`     // 单号(成交单号)
-	Marketid  int32  `json:"marketid"  xorm:"'MARKETID'" binding:"required"`   // 市场ID
-	Goodsid   int32  `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`     // 商品ID
-	Accountid int64  `json:"accountid"  xorm:"'ACCOUNTID'" binding:"required"` // 账户ID[报价币种]
-	Buyorsell int32  `json:"buyorsell"  xorm:"'BUYORSELL'" binding:"required"` // 买卖 - 0:买 1:卖
+	Tradeid        string    `json:"tradeid"  xorm:"'TRADEIDSTR'" binding:"required"` // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	Tradedate      string    `json:"tradedate"  xorm:"'TRADEDATE'"`                   // 交易日(yyyyMMdd)
+	Marketid       int32     `json:"marketid"  xorm:"'MARKETID'"`                     // 市场ID
+	Goodsid        int32     `json:"goodsid"  xorm:"'GOODSID'"`                       // 商品ID
+	Buyorderid     string    `json:"buyorderid"  xorm:"'BUYORDERIDSTR'"`              // 买方委托单号
+	Buyaccountid   int64     `json:"buyaccountid"  xorm:"'BUYACCOUNTID'"`             // 买方账号ID[报价币种]
+	Sellorderid    string    `json:"sellorderid"  xorm:"'SELLORDERIDSTR'"`            // 卖方委托单号
+	Sellaccountid  int64     `json:"sellaccountid"  xorm:"'SELLACCOUNTID'"`           // 卖方账号ID[报价币种]
+	Tradeamount    float64   `json:"tradeamount"  xorm:"'TRADEAMOUNT'"`               // 成交金额
+	Tradecharge    float64   `json:"tradecharge"  xorm:"'TRADECHARGE'"`               // 成交手续费(买方)
+	Payflag        int32     `json:"payflag"  xorm:"'PAYFLAG'"`                       // 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期 6:预售终止
+	Createtime     time.Time `json:"createtime"  xorm:"'CREATETIME'"`                 // 创建时间
+	Paytime        time.Time `json:"paytime"  xorm:"'PAYTIME'"`                       // 付款时间
+	Paylimitedtime time.Time `json:"paylimitedtime"  xorm:"'PAYLIMITEDTIME'"`         // 支付期限
+	Offamount      float64   `json:"offamount"  xorm:"'OFFAMOUNT'"`                   // 优惠金额
+	Tradeprice     float64   `json:"tradeprice"  xorm:"'TRADEPRICE'"`                 // 成交价格
+	Tradeqty       int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`                     // 成交数量
+	Payamount      float64   `json:"payamount"  xorm:"'PAYAMOUNT'"`                   // 支付金额 = TradeAmount + TradeCharge - OffAmount
 
 	Goodscode    string  `json:"goodscode"  xorm:"'GOODSCODE'" binding:"required"` // 商品代码(内部)
 	Goodsname    string  `json:"goodsname"  xorm:"'GOODSNAME'" binding:"required"` // 商品名称
@@ -1141,21 +1155,10 @@ type HsbyBuyMyPayOrder struct {
 
 	Vendorname1 string `json:"vendorname1"  xorm:"'VENDORNAME1'"` // 预售商品供应商名称
 	Vendorname2 string `json:"vendorname2"  xorm:"'VENDORNAME2'"` // 挂牌商品供应商名称
-
-	Tradeamount    float64   `json:"tradeamount"  xorm:"'TRADEAMOUNT'"`       // 成交金额
-	Tradecharge    float64   `json:"tradecharge"  xorm:"'TRADECHARGE'"`       // 成交手续费(买方)
-	Payflag        int32     `json:"payflag"  xorm:"'PAYFLAG'"`               // 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期
-	Createtime     time.Time `json:"createtime"  xorm:"'CREATETIME'"`         // 创建时间
-	Paylimitedtime time.Time `json:"paylimitedtime"  xorm:"'PAYLIMITEDTIME'"` // 支付期限
-	Offamount      float64   `json:"offamount"  xorm:"'OFFAMOUNT'"`           // 优惠金额
-	Tradeprice     float64   `json:"tradeprice"  xorm:"'TRADEPRICE'"`         // 成交价格
-	Tradeqty       int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`             // 成交数量
-
-	Accountname string `json:"accountname"  xorm:"'ACCOUNTNAME'"` // 购买方名称
 }
 
 // GetHsbyBuyMyPayOrders 获取待付款信息
-func GetHsbyBuyMyPayOrders(accountIDs, payFlag string, sellOrderID, sellAccountID int) ([]HsbyBuyMyPayOrder, error) {
+func GetHsbyBuyMyPayOrders(accountIDs string) ([]HsbyBuyMyPayOrder, error) {
 	// 获取市场信息
 	markets, err := GetMarkets()
 	if err != nil {
@@ -1176,38 +1179,23 @@ func GetHsbyBuyMyPayOrders(accountIDs, payFlag string, sellOrderID, sellAccountI
 	}
 
 	orders := make([]HsbyBuyMyPayOrder, 0)
-	session := engine.Table("TRADE_TRADEDETAIL").
-		Select(`to_char(TRADE_TRADEDETAIL.TRADEID) ORDERID, 
-				TRADE_TRADEDETAIL.MARKETID, TRADE_TRADEDETAIL.GOODSID, TRADE_TRADEDETAIL.ACCOUNTID, TRADE_TRADEDETAIL.BUYORSELL,
+	session := engine.Table("TRADE_PAYORDER TP").
+		Select(`to_char(TP.TRADEID) TRADEIDSTR, to_char(TP.BUYORDERID) BUYORDERIDSTR, to_char(TP.SELLORDERID) SELLORDERIDSTR, TP.*,
 				GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, GOODS.AGREEUNIT, 
 				HG1.PICURLS PICURLS1, HG2.PICURLS PICURLS2, 
 				MARKET.TRADEMODE, 
 				ENUMDICITEM.PARAM2 CURRENCYSIGN, 
-				HS1.VENDORNAME VENDORNAME1, HS2.VENDORNAME VENDORNAME2,
-				TP.TRADEAMOUNT, TP.TRADECHARGE, TP.PAYFLAG, TP.CREATETIME, TP.PAYLIMITEDTIME, TP.OFFAMOUNT, TP.TRADEPRICE, TP.TRADEQTY, 
-				U.ACCOUNTNAME`).
-		Join("LEFT", "GOODS", "GOODS.GOODSID = TRADE_TRADEDETAIL.GOODSID").
-		Join("LEFT", "CPTRADE_PRESALEGOODSEX", "CPTRADE_PRESALEGOODSEX.GOODSID = TRADE_TRADEDETAIL.GOODSID").
-		Join("LEFT", "HSBY_GOODSEX HG1", "HG1.GOODSID = CPTRADE_PRESALEGOODSEX.RELATEDGOODSID").
+				HS1.VENDORNAME VENDORNAME1, HS2.VENDORNAME VENDORNAME2`).
+		Join("LEFT", "GOODS", "GOODS.GOODSID = TP.GOODSID").
+		Join("LEFT", "CPTRADE_PRESALEGOODSEX CP", "CP.GOODSID = TP.GOODSID").
+		Join("LEFT", "HSBY_GOODSEX HG1", "HG1.GOODSID = CP.RELATEDGOODSID").
 		Join("LEFT", "HSBY_GOODSEX HG2", "HG2.GOODSID = GOODS.GOODSID").
 		Join("LEFT", "ENUMDICITEM", "GOODS.CURRENCYID = ENUMDICITEM.ENUMITEMNAME and ENUMDICITEM.ENUMDICCODE = 'currency'").
-		Join("LEFT", "MARKET", "MARKET.MARKETID = TRADE_TRADEDETAIL.MARKETID").
+		Join("LEFT", "MARKET", "MARKET.MARKETID = TP.MARKETID").
 		Join("LEFT", "HSBY_SUPPLIERINFO HS1", "HS1.VENDORID = HG1.VENDORID").
 		Join("LEFT", "HSBY_SUPPLIERINFO HS2", "HS2.VENDORID = HG2.VENDORID").
-		Join("INNER", "TRADE_PAYORDER TP", fmt.Sprintf("TP.TRADEID = TRADE_TRADEDETAIL.TRADEID and TP.PAYFLAG in (%s)", payFlag)).
-		Join("LEFT", "TAACCOUNT TA", "TA.ACCOUNTID = TP.BUYACCOUNTID").
-		Join("LEFT", "USERACCOUNT U", "U.USERID = TA.RELATEDUSERID").
-		Where(`TRADE_TRADEDETAIL.BUYORSELL = 0`).
-		And(fmt.Sprintf("TRADE_TRADEDETAIL.MARKETID in (%s)", marketIDs))
-	if len(accountIDs) > 0 {
-		session = session.And(fmt.Sprintf("TRADE_TRADEDETAIL.ACCOUNTID in (%s)", accountIDs))
-	}
-	if sellOrderID != 0 {
-		session = session.And("TP.SELLORDERID = ?", sellOrderID)
-	}
-	if sellAccountID != 0 {
-		session = session.And("TP.SELLACCOUNTID = ?", sellAccountID)
-	}
+		Where(fmt.Sprintf(`TP.PAYFLAG = 1 and TP.BUYACCOUNTID in (%s)`, accountIDs)).
+		And(fmt.Sprintf("TP.MARKETID in (%s)", marketIDs))
 	if err := session.Find(&orders); err != nil {
 		return nil, err
 	}

+ 1 - 1
routers/router.go

@@ -257,7 +257,7 @@ func InitRouter() *gin.Engine {
 		// 获取我的订单与包裹数量
 		hsbyR.GET("/GetHsbyMyCount", hsby.GetHsbyMyCount)
 		// 获取待付款信息
-		hsbyR.GET("/QueryTradePayOrders", hsby.QueryTradePayOrders)
+		hsbyR.GET("/QueryMyPayOrders", hsby.QueryMyPayOrders)
 		// 查询海商报业相关市场信息
 		hsbyR.GET("/QueryHsbyMarkets", hsby.QueryHsbyMarkets)
 	}

+ 9 - 8
token/token.go

@@ -3,6 +3,7 @@ package token
 import (
 	"errors"
 	"fmt"
+	"mtp2_if/config"
 	"mtp2_if/global/e"
 	"mtp2_if/rediscli"
 	"net/http"
@@ -34,10 +35,10 @@ func CheckToken(loginid string, token string) error {
 // Auth Token校验中间件
 func Auth() gin.HandlerFunc {
 	return func(c *gin.Context) {
-		// if config.SerCfg.GetDebugMode() {
-		// 	c.Next()
-		// 	return
-		// }
+		if config.SerCfg.GetDebugMode() {
+			c.Next()
+			return
+		}
 
 		var code int
 		var data interface{}
@@ -128,10 +129,10 @@ func AuthByHsby() gin.HandlerFunc {
 }
 
 func realToken(c *gin.Context) {
-	// if config.SerCfg.GetDebugMode() {
-	// 	c.Next()
-	// 	return
-	// }
+	if config.SerCfg.GetDebugMode() {
+		c.Next()
+		return
+	}
 
 	var code int
 	var data interface{}