Explorar o código

1、增加我的优惠卷数量统计;
2、增加市场运行参数接口;
3、修改BUG。

zhou.xiaoning %!s(int64=4) %!d(string=hai) anos
pai
achega
ee328e483e
Modificáronse 9 ficheiros con 515 adicións e 65 borrados
  1. 43 50
      config/config.xml
  2. 21 6
      controllers/hsby/hsby.go
  3. 51 0
      controllers/market/market.go
  4. 119 2
      docs/docs.go
  5. 119 2
      docs/swagger.json
  6. 89 2
      docs/swagger.yaml
  7. 49 3
      models/hsby.go
  8. 16 0
      models/market.go
  9. 8 0
      routers/router.go

+ 43 - 50
config/config.xml

@@ -1,52 +1,45 @@
 <?xml version="1.0" encoding="utf-8"?>
-
 <Configuration xmlns:http="http://www.w3.org/2001/XMLSchema-instance">
-    <WebSetting>
-        <ListenAddress value="0.0.0.0:8080"/>
-        <DebugMode value="1"/>
-    </WebSetting>
-
-    <LogSetting>
-        <LogPath value="log"/>
-        <LogLevel value="5"/>
-    </LogSetting>
-
-    <DbSetting>
-        <DbDriver  value="oci8"/>
-        <DbAddress value="192.168.31.117"/>
-        <DbName    value="orcl"/>
-        <DbPort    value="1521"/>
-        <DbUser    value="mtp2_test82"/>
-        <DbPwd     value="muchinfo"/>
-    </DbSetting>
-
-    <RedisSetting>
-        <Address   value="192.168.30.182"/>
-        <Port      value="5007"/>
-        <Timeout   value="3"/>
-        <ConnNum   value="1"/>
-        <DbNum     value="0"/>
-        <Pwd       value=""/>
-    </RedisSetting>
-
-    <MqSetting>
-        <Url       value="amqp://guest:guest@192.168.30.182:5020/test"/>
-        <Exchange  value="entry"/>
-    </MqSetting>
-
-    <MongoDBSetting>
-        <HostName   value="192.168.30.182"/>
-        <Port       value="5025"/>
-        <DBName     value="HistoryQuote"/>
-        <Username   value="quote_test01"/>
-        <Password   value="123456"/>
-    </MongoDBSetting>
-
-    <MySQLSetting>
-        <Host       value="192.168.30.140"/>
-        <Port       value="3306"/>
-        <DBName     value="historyquote_test166"/>
-        <Username   value="quote_test166"/>
-        <Password   value="123456"/>
-    </MySQLSetting>
-</Configuration>
+  <WebSetting>
+    <ListenAddress value="0.0.0.0:8080"/>
+    <DebugMode value="1"/>
+  </WebSetting>
+  <LogSetting>
+    <LogPath value="/home/pub/mtp2.0/log/queryservice"/>
+    <LogLevel value="5"/>
+  </LogSetting>
+  <DbSetting>
+    <DbDriver value="oci8"/>
+    <DbAddress value="192.168.31.117"/>
+    <DbName value="orcl"/>
+    <DbPort value="1521"/>
+    <DbUser value="mtp2_test132"/>
+    <DbPwd value="muchinfo"/>
+  </DbSetting>
+  <RedisSetting>
+    <Address value="192.168.31.132"/>
+    <Port value="5007"/>
+    <Timeout value="3"/>
+    <ConnNum value="1"/>
+    <DbNum value="0"/>
+    <Pwd value=""/>
+  </RedisSetting>
+  <MqSetting>
+    <Url value="amqp://guest:guest@192.168.31.132:5020/test"/>
+    <Exchange value="entry"/>
+  </MqSetting>
+  <MongoDBSetting>
+    <HostName value="192.168.31.132"/>
+    <Port value="5025"/>
+    <DBName value="HistoryQuote"/>
+    <Username value="quote_test01"/>
+    <Password value="123456"/>
+  </MongoDBSetting>
+  <MySQLSetting>
+    <Host value="192.168.30.140"/>
+    <Port value="3306"/>
+    <DBName value="historyquote_test132"/>
+    <Username value="quote_test132"/>
+    <Password value="123456"/>
+  </MySQLSetting>
+</Configuration>

+ 21 - 6
controllers/hsby/hsby.go

@@ -789,6 +789,7 @@ type GetHsbyMyCountRsp struct {
 	MyPackageUnSendCount      int `json:"myPackageUnSendCount"`      // 我的包裹待发货数量
 	MyPackageUnReceiveCount   int `json:"myPackageUnReceiveCount"`   // 我的包裹待收货数量
 	MyPayOrderCount           int `json:"myPayOrderCount"`           // 我的订单待付款数量
+	MyCouponCount             int `json:"myCouponCount"`             // 我的优惠卷数量
 }
 
 // GetHsbyMyCount 获取我的订单与包裹数量
@@ -839,6 +840,15 @@ func GetHsbyMyCount(c *gin.Context) {
 		return
 	}
 
+	// 获取我的优惠卷数量
+	myCoupons, err := models.GetMyCoupons(req.AccountIDs, 0, 0)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("GetHsbyMyCount failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
 	// 统计数量
 	rsp := GetHsbyMyCountRsp{}
 	for _, v := range myOrderDetails {
@@ -860,6 +870,9 @@ func GetHsbyMyCount(c *gin.Context) {
 		}
 	}
 	rsp.MyPayOrderCount = len(myPayOrders)
+	for _, v := range myCoupons {
+		rsp.MyCouponCount += int(v.Curqty)
+	}
 
 	// 查询成功返回
 	logger.GetLogger().Debugln("GetHsbyMyCount successed: %v", rsp)
@@ -1046,10 +1059,11 @@ func QueryHsbyMarkets(c *gin.Context) {
 // QueryHsbyMarketGoodsesReq 查询特卖商品列表(三级商城)列表请求参数
 type QueryHsbyMarketGoodsesReq struct {
 	app.PageInfo
-	MarketIDs  string `form:"marketIDs" binding:"required"`
-	AccountID  int    `form:"accountID"`
-	CategoryID int    `form:"categoryID"`
-	GoodsIDs   string `form:"goodsIDs"`
+	MarketIDs    string `form:"marketIDs" binding:"required"`
+	AccountID    int    `form:"accountID"`
+	CategoryID   int    `form:"categoryID"`
+	GoodsIDs     string `form:"goodsIDs"`
+	CouponTypeID int    `form:"couponTypeID"`
 }
 
 // QueryHsbyMarketGoodses 查询特卖商品列表(三级商城)
@@ -1061,7 +1075,8 @@ type QueryHsbyMarketGoodsesReq struct {
 // @Param marketIDs query string true "市场ID列表,格式:1,2,3"
 // @Param accountID query int false "资金账户,主要用于判断商品是否有可用的优惠卷;如未登录可不传。"
 // @Param categoryID query int false "类别ID"
-// @Param goodsIDs query string false "商品ID列表,格式:1,2,3"
+// @Param goodsIDs query string false "商品ID列表,格式:1,2,3。主要用于商品搜索。"
+// @Param couponTypeID query int false "优惠券类型ID,主要用于显示优惠卷对应的商品列表。"
 // @Success 200 {object} models.HsbyMarketGoods
 // @Failure 500 {object} app.Response
 // @Router /HSBY/QueryHsbyMarketGoodses [get]
@@ -1078,7 +1093,7 @@ func QueryHsbyMarketGoodses(c *gin.Context) {
 	}
 
 	// 获取数据
-	goodses, err := models.GetHsbyMarketGoodses(req.MarketIDs, req.AccountID, req.CategoryID, req.GoodsIDs)
+	goodses, err := models.GetHsbyMarketGoodses(req.MarketIDs, req.AccountID, req.CategoryID, req.GoodsIDs, req.CouponTypeID)
 	if err != nil {
 		// 查询失败
 		logger.GetLogger().Errorf("QueryHsbyMarketGoodses failed: %s", err.Error())

+ 51 - 0
controllers/market/market.go

@@ -0,0 +1,51 @@
+package market
+
+import (
+	"mtp2_if/global/app"
+	"mtp2_if/global/e"
+	"mtp2_if/logger"
+	"mtp2_if/models"
+	"net/http"
+
+	"github.com/gin-gonic/gin"
+)
+
+// 通用市场
+
+// QueryMarketRunReq 查询市场运行信息请求参数
+type QueryMarketRunReq struct {
+	MarketID int `form:"marketID"`
+}
+
+// QueryMarketRun 查询市场运行信息
+// @Summary 查询市场运行信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param marketID query int false "市场ID,不传返回所有"
+// @Success 200 {object} models.Marketrun
+// @Failure 500 {object} app.Response
+// @Router /Market/QueryMarketRun [get]
+// @Tags 通用市场
+func QueryMarketRun(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryMarketRunReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryMarketRun failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	marketRuns, err := models.GetMarketRuns(req.MarketID)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryMarketRun failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	logger.GetLogger().Debugln("QueryMarketRun successed: %v", marketRuns)
+	appG.Response(http.StatusOK, e.SUCCESS, marketRuns)
+}

+ 119 - 2
docs/docs.go

@@ -1639,9 +1639,15 @@ var doc = `{
                         "in": "query"
                     },
                     {
+                        "type": "string",
+                        "description": "商品ID列表,格式:1,2,3。主要用于商品搜索。",
+                        "name": "goodsIDs",
+                        "in": "query"
+                    },
+                    {
                         "type": "integer",
-                        "description": "商品ID",
-                        "name": "goodsID",
+                        "description": "优惠券类型ID,主要用于显示优惠卷对应的商品列表。",
+                        "name": "couponTypeID",
                         "in": "query"
                     }
                 ],
@@ -2347,6 +2353,44 @@ var doc = `{
                 }
             }
         },
+        "/Market/QueryMarketRun": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用市场"
+                ],
+                "summary": "查询市场运行信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "市场ID,不传返回所有",
+                        "name": "marketID",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Marketrun"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Order/QueryHisTradeDetail": {
             "get": {
                 "security": [
@@ -6437,6 +6481,10 @@ var doc = `{
         "hsby.GetHsbyMyCountRsp": {
             "type": "object",
             "properties": {
+                "myCouponCount": {
+                    "description": "我的优惠卷数量",
+                    "type": "integer"
+                },
                 "myOrderDetailListingCount": {
                     "description": "我的订单求购中数量",
                     "type": "integer"
@@ -8027,6 +8075,75 @@ var doc = `{
                 }
             }
         },
+        "models.Marketrun": {
+            "type": "object",
+            "required": [
+                "marketid",
+                "nexttradedate",
+                "reckonflag",
+                "runstatus",
+                "tradedate",
+                "tradedate2"
+            ],
+            "properties": {
+                "afternexttradedate": {
+                    "description": "下下交易日",
+                    "type": "string"
+                },
+                "clearquoteflag": {
+                    "description": "行情清盘标志- 1:未发送 2:已发送 3:已回复",
+                    "type": "integer"
+                },
+                "lastreckondate": {
+                    "description": "最新交易日(结算成功)",
+                    "type": "string"
+                },
+                "machinedate": {
+                    "description": "机器时间",
+                    "type": "string"
+                },
+                "manualflag": {
+                    "description": "手动开市标志- 0:否 1:是  (市场为手动时,是否触发了手动开市标志)",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "nexttradedate": {
+                    "description": "下一交易日",
+                    "type": "string"
+                },
+                "pretradedate": {
+                    "description": "上一交易日",
+                    "type": "string"
+                },
+                "reckonflag": {
+                    "description": "结算标识 - 0: 停止结算 1: 正常(管理端控制此字段,交易服务根据此字段判断是否做结算)",
+                    "type": "integer"
+                },
+                "runstatus": {
+                    "description": "运行状态 - 0:初始化 1:待开市 2:开市 3:休市 4:手工休市 5:闭市 6:确认行权开始 7:确认行权结束 10:日终处理开始 11:日终处理成功 12:日终处理失败 13基础服务结算开始 14基础服务结算成功 23.资金结算开始 24.资金结算成功 25.资金结算失败 26.系统结算成功 27.系统结算失败 28.盘中处理开始 29.盘中处理成功 30.盘中处理失败 31.资金结算开始(内) 32.资金结算成功(内) 33.资金结算失败(内) 40.签到开始 41.签到成功 42.签到部份成功 43.签到失败 44.签退开始 45.签退成功 46.签退部份成功 47.签退失败 48.对账开始 49.对账成功 50.对账失败 51.清算开始 52.清算成功 53.清算失败 54.清算部分成功 55. 系统结算开始 62.今日免清算",
+                    "type": "integer"
+                },
+                "sectionid": {
+                    "description": "时间段号[多时段时用]",
+                    "type": "integer"
+                },
+                "tradedate": {
+                    "description": "当前交易日(服务) 资金结算完成即变更,供交易服务使用",
+                    "type": "string"
+                },
+                "tradedate2": {
+                    "description": "当前交易日(行情) 在第一个市场待开市时变更为TradeDate,供行情及终端系统使用",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                }
+            }
+        },
         "models.Messageboard": {
             "type": "object",
             "required": [

+ 119 - 2
docs/swagger.json

@@ -1623,9 +1623,15 @@
                         "in": "query"
                     },
                     {
+                        "type": "string",
+                        "description": "商品ID列表,格式:1,2,3。主要用于商品搜索。",
+                        "name": "goodsIDs",
+                        "in": "query"
+                    },
+                    {
                         "type": "integer",
-                        "description": "商品ID",
-                        "name": "goodsID",
+                        "description": "优惠券类型ID,主要用于显示优惠卷对应的商品列表。",
+                        "name": "couponTypeID",
                         "in": "query"
                     }
                 ],
@@ -2331,6 +2337,44 @@
                 }
             }
         },
+        "/Market/QueryMarketRun": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用市场"
+                ],
+                "summary": "查询市场运行信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "市场ID,不传返回所有",
+                        "name": "marketID",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Marketrun"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Order/QueryHisTradeDetail": {
             "get": {
                 "security": [
@@ -6421,6 +6465,10 @@
         "hsby.GetHsbyMyCountRsp": {
             "type": "object",
             "properties": {
+                "myCouponCount": {
+                    "description": "我的优惠卷数量",
+                    "type": "integer"
+                },
                 "myOrderDetailListingCount": {
                     "description": "我的订单求购中数量",
                     "type": "integer"
@@ -8011,6 +8059,75 @@
                 }
             }
         },
+        "models.Marketrun": {
+            "type": "object",
+            "required": [
+                "marketid",
+                "nexttradedate",
+                "reckonflag",
+                "runstatus",
+                "tradedate",
+                "tradedate2"
+            ],
+            "properties": {
+                "afternexttradedate": {
+                    "description": "下下交易日",
+                    "type": "string"
+                },
+                "clearquoteflag": {
+                    "description": "行情清盘标志- 1:未发送 2:已发送 3:已回复",
+                    "type": "integer"
+                },
+                "lastreckondate": {
+                    "description": "最新交易日(结算成功)",
+                    "type": "string"
+                },
+                "machinedate": {
+                    "description": "机器时间",
+                    "type": "string"
+                },
+                "manualflag": {
+                    "description": "手动开市标志- 0:否 1:是  (市场为手动时,是否触发了手动开市标志)",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "nexttradedate": {
+                    "description": "下一交易日",
+                    "type": "string"
+                },
+                "pretradedate": {
+                    "description": "上一交易日",
+                    "type": "string"
+                },
+                "reckonflag": {
+                    "description": "结算标识 - 0: 停止结算 1: 正常(管理端控制此字段,交易服务根据此字段判断是否做结算)",
+                    "type": "integer"
+                },
+                "runstatus": {
+                    "description": "运行状态 - 0:初始化 1:待开市 2:开市 3:休市 4:手工休市 5:闭市 6:确认行权开始 7:确认行权结束 10:日终处理开始 11:日终处理成功 12:日终处理失败 13基础服务结算开始 14基础服务结算成功 23.资金结算开始 24.资金结算成功 25.资金结算失败 26.系统结算成功 27.系统结算失败 28.盘中处理开始 29.盘中处理成功 30.盘中处理失败 31.资金结算开始(内) 32.资金结算成功(内) 33.资金结算失败(内) 40.签到开始 41.签到成功 42.签到部份成功 43.签到失败 44.签退开始 45.签退成功 46.签退部份成功 47.签退失败 48.对账开始 49.对账成功 50.对账失败 51.清算开始 52.清算成功 53.清算失败 54.清算部分成功 55. 系统结算开始 62.今日免清算",
+                    "type": "integer"
+                },
+                "sectionid": {
+                    "description": "时间段号[多时段时用]",
+                    "type": "integer"
+                },
+                "tradedate": {
+                    "description": "当前交易日(服务) 资金结算完成即变更,供交易服务使用",
+                    "type": "string"
+                },
+                "tradedate2": {
+                    "description": "当前交易日(行情) 在第一个市场待开市时变更为TradeDate,供行情及终端系统使用",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                }
+            }
+        },
         "models.Messageboard": {
             "type": "object",
             "required": [

+ 89 - 2
docs/swagger.yaml

@@ -1987,6 +1987,9 @@ definitions:
     type: object
   hsby.GetHsbyMyCountRsp:
     properties:
+      myCouponCount:
+        description: 我的优惠卷数量
+        type: integer
       myOrderDetailListingCount:
         description: 我的订单求购中数量
         type: integer
@@ -3200,6 +3203,63 @@ definitions:
     - ordertime
     - trademode
     type: object
+  models.Marketrun:
+    properties:
+      afternexttradedate:
+        description: 下下交易日
+        type: string
+      clearquoteflag:
+        description: 行情清盘标志- 1:未发送 2:已发送 3:已回复
+        type: integer
+      lastreckondate:
+        description: 最新交易日(结算成功)
+        type: string
+      machinedate:
+        description: 机器时间
+        type: string
+      manualflag:
+        description: 手动开市标志- 0:否 1:是  (市场为手动时,是否触发了手动开市标志)
+        type: integer
+      marketid:
+        description: 市场ID
+        type: integer
+      nexttradedate:
+        description: 下一交易日
+        type: string
+      pretradedate:
+        description: 上一交易日
+        type: string
+      reckonflag:
+        description: '结算标识 - 0: 停止结算 1: 正常(管理端控制此字段,交易服务根据此字段判断是否做结算)'
+        type: integer
+      runstatus:
+        description: 运行状态 - 0:初始化 1:待开市 2:开市 3:休市 4:手工休市 5:闭市 6:确认行权开始 7:确认行权结束 10:日终处理开始
+          11:日终处理成功 12:日终处理失败 13基础服务结算开始 14基础服务结算成功 23.资金结算开始 24.资金结算成功 25.资金结算失败
+          26.系统结算成功 27.系统结算失败 28.盘中处理开始 29.盘中处理成功 30.盘中处理失败 31.资金结算开始(内) 32.资金结算成功(内)
+          33.资金结算失败(内) 40.签到开始 41.签到成功 42.签到部份成功 43.签到失败 44.签退开始 45.签退成功 46.签退部份成功
+          47.签退失败 48.对账开始 49.对账成功 50.对账失败 51.清算开始 52.清算成功 53.清算失败 54.清算部分成功 55. 系统结算开始
+          62.今日免清算
+        type: integer
+      sectionid:
+        description: 时间段号[多时段时用]
+        type: integer
+      tradedate:
+        description: 当前交易日(服务) 资金结算完成即变更,供交易服务使用
+        type: string
+      tradedate2:
+        description: 当前交易日(行情) 在第一个市场待开市时变更为TradeDate,供行情及终端系统使用
+        type: string
+      updatetime:
+        description: 更新时间
+        type: string
+    required:
+    - marketid
+    - nexttradedate
+    - reckonflag
+    - runstatus
+    - tradedate
+    - tradedate2
+    type: object
   models.Messageboard:
     properties:
       createtime:
@@ -6383,9 +6443,13 @@ paths:
         in: query
         name: categoryID
         type: integer
-      - description: 商品ID
+      - description: 商品ID列表,格式:1,2,3。主要用于商品搜索。
         in: query
-        name: goodsID
+        name: goodsIDs
+        type: string
+      - description: 优惠券类型ID,主要用于显示优惠卷对应的商品列表。
+        in: query
+        name: couponTypeID
         type: integer
       produces:
       - application/json
@@ -6834,6 +6898,29 @@ paths:
       summary: 设置我的包裹已收货状态
       tags:
       - 定制【海商报业】
+  /Market/QueryMarketRun:
+    get:
+      parameters:
+      - description: 市场ID,不传返回所有
+        in: query
+        name: marketID
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.Marketrun'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询市场运行信息
+      tags:
+      - 通用市场
   /Order/QueryHisTradeDetail:
     get:
       parameters:

+ 49 - 3
models/hsby.go

@@ -477,6 +477,7 @@ func GetHsbyBuyMyOrderDetails(accountIDs string, myBuyStatus int) ([]HybsMyBuyOr
 	// 委托状态
 	orderStatus := "0" // 单据状态,为0的时候查询全部
 	marketIDs := ""    // 我的订单包括一二级市场的单据
+	// FIXME: myBuyStatus 目前终端不传
 	switch myBuyStatus {
 	case 1: // 抢购中 (一级市场)
 		// 获取市场ID
@@ -508,7 +509,7 @@ func GetHsbyBuyMyOrderDetails(accountIDs string, myBuyStatus int) ([]HybsMyBuyOr
 	// 默认取 TradeMode = 16 or 71 的市场
 	if len(marketIDs) == 0 {
 		for _, v := range markets {
-			if v.Trademode == 16 || v.Trademode == 71 {
+			if v.Trademode == 16 || v.Trademode == 71 || v.Trademode == 70 {
 				if len(marketIDs) == 0 {
 					marketIDs = strconv.Itoa(int(v.Marketid))
 				} else {
@@ -1244,7 +1245,7 @@ func GetHsbyBuyMyPayOrders(accountIDs string, buyOrderID, sellOrderID int) ([]Hs
 	marketIDs := "" // 我的订单包括一二级市场卖方向成交单
 	// 默认取 TradeMode = 16
 	for _, v := range markets {
-		if v.Trademode == 16 || v.Trademode == 71 {
+		if v.Trademode == 16 || v.Trademode == 71 || v.Trademode == 70 {
 			if len(marketIDs) == 0 {
 				marketIDs = strconv.Itoa(int(v.Marketid))
 			} else {
@@ -1412,9 +1413,15 @@ type HsbyMarketGoods struct {
 }
 
 // GetHsbyMarketGoodses 获取商城商品列表(三级商城)
-func GetHsbyMarketGoodses(marketIDs string, accountID, categoryID int, goodsIDs string) ([]HsbyMarketGoods, error) {
+func GetHsbyMarketGoodses(marketIDs string, accountID, categoryID int, goodsIDs string, couponTypeID int) ([]HsbyMarketGoods, error) {
 	engine := db.GetEngine()
 
+	// 获取优惠卷类型信息
+	var couponType Coupontype
+	if _, err := engine.Where("ISVALID = 1 and COUPONTYPEID = ?", couponTypeID).Get(&couponType); err != nil {
+		return nil, err
+	}
+
 	orders := make([]HsbyMarketGoods, 0)
 	// 与挂牌点选不一样的是商城是以委托单为主表;已经卖完的委托单不显示
 	session := engine.Table("TRADE_ORDERDETAIL T").
@@ -1438,6 +1445,45 @@ func GetHsbyMarketGoodses(marketIDs string, accountID, categoryID int, goodsIDs
 	if len(goodsIDs) > 0 {
 		session = session.And(fmt.Sprintf("G.GOODSID in (%s)", goodsIDs))
 	}
+	if couponTypeID > 0 {
+		if couponType.Coupontypeid == 0 {
+			// 没有查询到对应的优惠卷,直接返回空数组
+			return make([]HsbyMarketGoods, 0), nil
+		}
+
+		// 优惠卷特定商品
+		if couponType.Limitedflag == 1 {
+			// 去掉头尾逗号
+			limitedGoodsIDs := couponType.Limitedgoodsids
+			if strings.HasPrefix(limitedGoodsIDs, ",") && strings.HasSuffix(limitedGoodsIDs, ",") {
+				limitedGoodsIDs = limitedGoodsIDs[1 : len(limitedGoodsIDs)-1]
+			}
+			session = session.And(fmt.Sprintf("T.GOODSID in (%s)", limitedGoodsIDs))
+		}
+
+		// 优惠卷特定卖家
+		if couponType.Isgeneral == 0 {
+			// 去掉头尾逗号
+			userScope := couponType.Userscope
+			if strings.HasPrefix(userScope, ",") && strings.HasSuffix(userScope, ",") {
+				userScope = userScope[1 : len(userScope)-1]
+			}
+			// 查询对应的卖家资金账户信息
+			taAccounts := make([]Taaccount, 0)
+			if err := engine.Where(fmt.Sprintf("RELATEDUSERID in (%s)", userScope)).Find(&taAccounts); err != nil {
+				return nil, err
+			}
+			sellAccountIDs := ""
+			for _, v := range taAccounts {
+				if len(sellAccountIDs) == 0 {
+					sellAccountIDs = strconv.Itoa(int(v.Accountid))
+				} else {
+					sellAccountIDs += "," + strconv.Itoa(int(v.Accountid))
+				}
+			}
+			session = session.And(fmt.Sprintf("T.ACCOUNTID in (%s)", sellAccountIDs))
+		}
+	}
 	if err := session.Find(&orders); err != nil {
 		return nil, err
 	}

+ 16 - 0
models/market.go

@@ -248,6 +248,22 @@ func GetMarketRun(marketID int) (*Marketrun, error) {
 	return nil, nil
 }
 
+// GetMarketRuns 获取目标市场运行参数信息
+func GetMarketRuns(marketID int) ([]Marketrun, error) {
+	engine := db.GetEngine()
+
+	marketRuns := make([]Marketrun, 0)
+	session := engine.Table("MARKETRUN")
+	if marketID > 0 {
+		session = session.Where("MARKETID = ?", marketID)
+	}
+	if err := session.Find(&marketRuns); err != nil {
+		return nil, err
+	}
+
+	return marketRuns, nil
+}
+
 // FindQuoteSourceGroupRunStepsByMarket 通过市场获取对应的行情源分组开休市计划明细信息
 // 参数 market Market 市场信息
 // 返回值 []Quotesourcegrouprunstep 行情源分组开休市计划明细信息

+ 8 - 0
routers/router.go

@@ -9,6 +9,7 @@ import (
 	"mtp2_if/controllers/erms2"
 	"mtp2_if/controllers/erms3"
 	"mtp2_if/controllers/hsby"
+	"mtp2_if/controllers/market"
 	"mtp2_if/controllers/order"
 	"mtp2_if/controllers/quote"
 	"mtp2_if/controllers/search"
@@ -106,6 +107,13 @@ func InitRouter() *gin.Engine {
 		// 通知公告设置已读请求
 		commonR.Use(token.Auth()).POST("/NoticeReaded", common.NoticeReaded)
 	}
+	// ************************ 通用市场 ************************
+	marketR := apiR.Group("Market")
+	marketR.Use(token.Auth())
+	{
+		// 查询市场运行信息
+		marketR.GET("/QueryMarketRun", market.QueryMarketRun)
+	}
 	// ************************ 通用单据 ************************
 	orderR := apiR.Group("Order")
 	orderR.Use(token.Auth())