Procházet zdrojové kódy

修改接口,添加字段

zhou.xiaoning před 5 roky
rodič
revize
0d23ac663b
4 změnil soubory, kde provedl 60 přidání a 3 odebrání
  1. 16 0
      docs/docs.go
  2. 16 0
      docs/swagger.json
  3. 12 0
      docs/swagger.yaml
  4. 16 3
      models/hsby.go

+ 16 - 0
docs/docs.go

@@ -3657,6 +3657,14 @@ var doc = `{
                     "description": "现价",
                     "type": "number"
                 },
+                "limitdown": {
+                    "description": "跌停价",
+                    "type": "number"
+                },
+                "limitup": {
+                    "description": "涨停价",
+                    "type": "number"
+                },
                 "marketid": {
                     "description": "所属市场ID",
                     "type": "integer"
@@ -3796,6 +3804,10 @@ var doc = `{
                     "description": "委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
                     "type": "integer"
                 },
+                "orderprice": {
+                    "description": "委托价格",
+                    "type": "number"
+                },
                 "orderqty": {
                     "description": "委托数量",
                     "type": "integer"
@@ -3819,6 +3831,10 @@ var doc = `{
                 "tradeqty": {
                     "description": "成交数量",
                     "type": "integer"
+                },
+                "vendorname": {
+                    "description": "供应商名称",
+                    "type": "string"
                 }
             }
         },

+ 16 - 0
docs/swagger.json

@@ -3641,6 +3641,14 @@
                     "description": "现价",
                     "type": "number"
                 },
+                "limitdown": {
+                    "description": "跌停价",
+                    "type": "number"
+                },
+                "limitup": {
+                    "description": "涨停价",
+                    "type": "number"
+                },
                 "marketid": {
                     "description": "所属市场ID",
                     "type": "integer"
@@ -3780,6 +3788,10 @@
                     "description": "委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
                     "type": "integer"
                 },
+                "orderprice": {
+                    "description": "委托价格",
+                    "type": "number"
+                },
                 "orderqty": {
                     "description": "委托数量",
                     "type": "integer"
@@ -3803,6 +3815,10 @@
                 "tradeqty": {
                     "description": "成交数量",
                     "type": "integer"
+                },
+                "vendorname": {
+                    "description": "供应商名称",
+                    "type": "string"
                 }
             }
         },

+ 12 - 0
docs/swagger.yaml

@@ -1305,6 +1305,12 @@ definitions:
       last:
         description: 现价
         type: number
+      limitdown:
+        description: 跌停价
+        type: number
+      limitup:
+        description: 涨停价
+        type: number
       marketid:
         description: 所属市场ID
         type: integer
@@ -1405,6 +1411,9 @@ definitions:
       orderid:
         description: 委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
         type: integer
+      orderprice:
+        description: 委托价格
+        type: number
       orderqty:
         description: 委托数量
         type: integer
@@ -1426,6 +1435,9 @@ definitions:
       tradeqty:
         description: 成交数量
         type: integer
+      vendorname:
+        description: 供应商名称
+        type: string
     required:
     - accountid
     - buyorsell

+ 16 - 3
models/hsby.go

@@ -151,7 +151,9 @@ type HsbyListingGoodsDetail struct {
 	Vendorphone string `json:"vendorphone"  xorm:"'VENDORPHONE'"` // 供应商客服电话
 	Vendorattr  string `json:"vendorattr"  xorm:"'VENDORATTR'"`   // 供应商附件(多张,逗号分隔)
 
-	Last float64 `json:"last" xorm:"-"` // 现价
+	Last      float64 `json:"last" xorm:"-"`      // 现价
+	Limitup   float64 `json:"limitup" xorm:"-"`   // 涨停价
+	Limitdown float64 `json:"limitdown" xorm:"-"` // 跌停价
 }
 
 // GetHsbyListingGoodsDetail 获取二级市场(挂牌点选)商品信息详情
@@ -182,7 +184,7 @@ func GetHsbyListingGoodsDetail(goodsID int) (*HsbyListingGoodsDetail, error) {
 	}
 	hsbyListingGoodsDetail := details[0]
 
-	// 获取商品现价
+	// 获取商品现价和涨跌停价
 	quoteDays, err := GetQuoteDays(hsbyListingGoodsDetail.Goodscode)
 	if err != nil {
 		return nil, err
@@ -191,6 +193,12 @@ func GetHsbyListingGoodsDetail(goodsID int) (*HsbyListingGoodsDetail, error) {
 		if quoteDays[0].Last != 0 {
 			hsbyListingGoodsDetail.Last = utils.IntToFloat64(int(quoteDays[0].Last), int(hsbyListingGoodsDetail.Decimalplace))
 		}
+		if quoteDays[0].Limitup != 0 {
+			hsbyListingGoodsDetail.Limitup = utils.IntToFloat64(int(quoteDays[0].Limitup), int(hsbyListingGoodsDetail.Decimalplace))
+		}
+		if quoteDays[0].Limitdown != 0 {
+			hsbyListingGoodsDetail.Limitdown = utils.IntToFloat64(int(quoteDays[0].Limitdown), int(hsbyListingGoodsDetail.Decimalplace))
+		}
 	}
 
 	return &hsbyListingGoodsDetail, nil
@@ -285,6 +293,7 @@ type HybsMyBuyOrderDetail struct {
 	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:卖
+	Orderprice        float64   `json:"orderprice"  xorm:"'ORDERPRICE'"`                  // 委托价格
 	Orderqty          int64     `json:"orderqty"  xorm:"'ORDERQTY'" binding:"required"`   // 委托数量
 	Tradeqty          int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`                      // 成交数量
 	Cancelqty         int64     `json:"cancelqty"  xorm:"'CANCELQTY'"`                    // 撤单数量
@@ -301,6 +310,8 @@ type HybsMyBuyOrderDetail struct {
 
 	Currencysign string `json:"currencysign" xorm:"'CURRENCYSIGN'"` // 货币符号
 
+	Vendorname string `json:"vendorname"  xorm:"'VENDORNAME'"` // 供应商名称
+
 	MyBuyStatus int `json:"mybuystatus" xorm:"-"` // "我的订单"显示状态- 1:抢购中 2:求购中 3:已完成 4:已撤消 5:委托失败
 }
 
@@ -350,11 +361,13 @@ func GetHsbyBuyMyOrderDetails(accountID, myBuyStatus int) ([]HybsMyBuyOrderDetai
 				GOODS.GOODSNAME, GOODS.DECIMALPLACE, 
 				HSBY_GOODSEX.PICURLS, 
 				MARKET.TRADEMODE, 
-				ENUMDICITEM.PARAM2 CURRENCYSIGN`).
+				ENUMDICITEM.PARAM2 CURRENCYSIGN,
+				HSBY_SUPPLIERINFO.VENDORNAME`).
 		Join("LEFT", "GOODS", "GOODS.GOODSID = TRADE_ORDERDETAIL.GOODSID").
 		Join("LEFT", "HSBY_GOODSEX", "HSBY_GOODSEX.GOODSID = GOODS.GOODSID").
 		Join("LEFT", "ENUMDICITEM", "GOODS.CURRENCYID = ENUMDICITEM.ENUMITEMNAME and ENUMDICITEM.ENUMDICCODE = 'currency'").
 		Join("LEFT", "MARKET", "MARKET.MARKETID = TRADE_ORDERDETAIL.MARKETID").
+		Join("LEFT", "HSBY_SUPPLIERINFO", "HSBY_SUPPLIERINFO.VENDORID = HSBY_GOODSEX.VENDORID").
 		Where("TRADE_ORDERDETAIL.ACCOUNTID = ?", accountID)
 	// 是否过滤市场(抢购中、求购中)
 	if marketID > 0 {