Browse Source

修改BUG

zhou.xiaoning 4 years ago
parent
commit
5630f30e38
6 changed files with 65 additions and 70 deletions
  1. 49 42
      config/config.xml
  2. 9 3
      controllers/hsby/hsby.go
  3. 1 1
      docs/docs.go
  4. 1 1
      docs/swagger.json
  5. 1 1
      docs/swagger.yaml
  6. 4 22
      models/hsby.go

+ 49 - 42
config/config.xml

@@ -1,45 +1,52 @@
 <?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="/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_test104"/>
-    <DbPwd value="muchinfo"/>
-  </DbSetting>
-  <RedisSetting>
-    <Address value="192.168.31.104"/>
-    <Port value="5007"/>
-    <Timeout value="3"/>
-    <ConnNum value="1"/>
-    <DbNum value="0"/>
-    <Pwd value=""/>
-  </RedisSetting>
-  <MqSetting>
-    <Url value="amqp://guest:guest@192.168.31.104:5020/test"/>
-    <Exchange value="entry"/>
-  </MqSetting>
-  <MongoDBSetting>
-    <HostName value="192.168.31.104"/>
-    <Port value="5025"/>
-    <DBName value="HistoryQuote"/>
-    <Username value="quote_test01"/>
-    <Password value="123456"/>
-  </MongoDBSetting>
-  <MySQLSetting>
-    <Host value="192.168.30.113"/>
-    <Port value="3306"/>
-    <DBName value="historyquote_test104"/>
-    <Username value="quote_test104"/>
-    <Password value="123456"/>
-  </MySQLSetting>
+    <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>

+ 9 - 3
controllers/hsby/hsby.go

@@ -104,7 +104,7 @@ type QueryHsbyListingGoodsDetailReq struct {
 // @Produce json
 // @Security ApiKeyAuth
 // @Param goodsID query int true "商品ID"
-// @Param AccountID query int false "资金账户,主要用于获取交易规则。不传则获取通用规则。"
+// @Param accountID query int false "资金账户,主要用于获取交易规则。不传则获取通用规则。"
 // @Success 200 {object} models.HsbyListingGoodsDetail
 // @Failure 500 {object} app.Response
 // @Router /HSBY/QueryHsbyListingGoodsDetail [get]
@@ -149,7 +149,10 @@ func QueryHsbyListingGoodsDetail(c *gin.Context) {
 		for _, v := range tradeRuleInfoStruct.TradeRules {
 			if int(*v.RuleID) == 103 {
 				goodsInfo.LotSize = int(*v.ParamValue)
-				break
+			}
+			// 挂牌点选的最大建仓手数与预售的不一样,直接从规则里取
+			if int(*v.RuleID) == 104 {
+				goodsInfo.Buymaxqty = int(*v.ParamValue)
 			}
 		}
 	}
@@ -1194,7 +1197,10 @@ func QueryHsbyMarketGoodsDetail(c *gin.Context) {
 		for _, v := range tradeRuleInfoStruct.TradeRules {
 			if int(*v.RuleID) == 103 {
 				detail.LotSize = int(*v.ParamValue)
-				break
+			}
+			// 商城的最大建仓手数与预售的不一样,直接从规则里取
+			if int(*v.RuleID) == 104 {
+				detail.Buymaxqty = int(*v.ParamValue)
 			}
 		}
 	}

+ 1 - 1
docs/docs.go

@@ -1846,7 +1846,7 @@ var doc = `{
                     {
                         "type": "integer",
                         "description": "资金账户,主要用于获取交易规则。不传则获取通用规则。",
-                        "name": "AccountID",
+                        "name": "accountID",
                         "in": "query"
                     }
                 ],

+ 1 - 1
docs/swagger.json

@@ -1830,7 +1830,7 @@
                     {
                         "type": "integer",
                         "description": "资金账户,主要用于获取交易规则。不传则获取通用规则。",
-                        "name": "AccountID",
+                        "name": "accountID",
                         "in": "query"
                     }
                 ],

+ 1 - 1
docs/swagger.yaml

@@ -7132,7 +7132,7 @@ paths:
         type: integer
       - description: 资金账户,主要用于获取交易规则。不传则获取通用规则。
         in: query
-        name: AccountID
+        name: accountID
         type: integer
       produces:
       - application/json

+ 4 - 22
models/hsby.go

@@ -367,15 +367,6 @@ func GetHsbyListingGoodsDetail(goodsID, accountID int) (*HsbyListingGoodsDetail,
 	// 计算手数最小变动单位,改在上层进行设置,这里暂时设置成1
 	hsbyListingGoodsDetail.LotSize = 1
 
-	// 获取购买上限
-	if accountID != 0 {
-		buyMaxQty, err := GetCPTradeBuyLimit(goodsID, accountID)
-		if err != nil {
-			return nil, err
-		}
-		hsbyListingGoodsDetail.Buymaxqty = buyMaxQty
-	}
-
 	return &hsbyListingGoodsDetail, nil
 }
 
@@ -761,6 +752,7 @@ type HsbyPreGoodsDetail struct {
 	Refprice       float64 `json:"refprice"  xorm:"'REFPRICE'"`             // 参考价格[一口价]
 	Presaledqty    int64   `json:"presaledqty"  xorm:"'PRESALEDQTY'"`       // 已预售量(预售结束时更新)
 	EnableQty      int64   `json:"enableqty" xorm:"ENABLEQTY"`              // 剩余数量
+	Buymaxqty      int     `json:"buymaxqty"  xorm:"'BUYMAXQTY'"`           // 购买上限 [71] - 0为不限
 
 	Videourls      string `json:"videourls"  xorm:"'VIDEOURLS'"`           // 介绍视频[多张用逗号分隔]
 	Picurls        string `json:"picurls"  xorm:"'PICURLS'"`               // 介绍图片[多张用逗号分隔]
@@ -780,9 +772,8 @@ type HsbyPreGoodsDetail struct {
 
 	Customername string `json:"customername" xorm:"'CUSTOMERNAME'"` // 发行单位
 
-	StepValue float64 `json:"stepvalue" xorm:"-"`    // 价格最小变动单位
-	LotSize   int     `json:"lotsize" xorm:"-"`      // 手数最小变动单位
-	Buymaxqty int     `json:"buymaxqty"  xorm:"'-'"` // 购买上限 [71] - 0为不限
+	StepValue float64 `json:"stepvalue" xorm:"-"` // 价格最小变动单位
+	LotSize   int     `json:"lotsize" xorm:"-"`   // 手数最小变动单位
 }
 
 // GetHsbyPreGoodsDetail 获取一级市场(产能预售)商品信息详情
@@ -798,7 +789,7 @@ func GetHsbyPreGoodsDetail(goodsID, accountID int) (*HsbyPreGoodsDetail, error)
 	session := engine.Table("GOODS").
 		Select(`GOODS.*, 
 				CPTRADE_PRESALEGOODSEX.RELATEDGOODSID, CPTRADE_PRESALEGOODSEX.PRESALEQTY, CPTRADE_PRESALEGOODSEX.REFPRICE, 
-				CPTRADE_PRESALEGOODSEX.PRESALEDQTY, (CPTRADE_PRESALEGOODSEX.PRESALEQTY - CPTRADE_PRESALEGOODSEX.PRESALEDQTY) ENABLEQTY, 
+				CPTRADE_PRESALEGOODSEX.PRESALEDQTY, (CPTRADE_PRESALEGOODSEX.PRESALEQTY - CPTRADE_PRESALEGOODSEX.PRESALEDQTY) ENABLEQTY, CPTRADE_PRESALEGOODSEX.BUYMAXQTY, 
 				HSBY_GOODSEX.VIDEOURLS, HSBY_GOODSEX.PICURLS, HSBY_GOODSEX.DESCPROVINCEID, HSBY_GOODSEX.Desccityid, HSBY_GOODSEX.Goodsdesc,
 				ENUMDICITEM.ENUMDICNAME CURRENCY, ENUMDICITEM.PARAM2 CURRENCYSIGN, 
 				E1.ENUMDICNAME GOODUNIT, 
@@ -1675,15 +1666,6 @@ func GetHsbyMarketGoodsDetail(orderID, accountID int) (*HsbyMarketGoodsDetail, e
 	// 最小交易手数在上层进行设置,这里暂设置为1
 	hsbyMarketGoodsDetail.LotSize = 1
 
-	// 获取购买上限
-	if accountID != 0 {
-		buyMaxQty, err := GetCPTradeBuyLimit(int(hsbyMarketGoodsDetail.Goodsid), accountID)
-		if err != nil {
-			return nil, err
-		}
-		hsbyMarketGoodsDetail.Buymaxqty = buyMaxQty
-	}
-
 	return &hsbyMarketGoodsDetail, nil
 }