|
|
@@ -301,18 +301,19 @@ type HsbyListingGoodsDetail struct {
|
|
|
|
|
|
Trademode int32 `json:"trademode" xorm:"'TRADEMODE'" binding:"required"` // 交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价
|
|
|
|
|
|
- Last float64 `json:"last" xorm:"-"` // 现价
|
|
|
- Limitup float64 `json:"limitup" xorm:"-"` // 涨停价
|
|
|
- Limitdown float64 `json:"limitdown" xorm:"-"` // 跌停价
|
|
|
- StepValue float64 `json:"stepvalue" xorm:"-"` // 价格最小变动单位
|
|
|
- LotSize int `json:"lotsize" xorm:"-"` // 手数最小变动单位
|
|
|
+ Last float64 `json:"last" xorm:"-"` // 现价
|
|
|
+ Limitup float64 `json:"limitup" xorm:"-"` // 涨停价
|
|
|
+ Limitdown float64 `json:"limitdown" xorm:"-"` // 跌停价
|
|
|
+ StepValue float64 `json:"stepvalue" xorm:"-"` // 价格最小变动单位
|
|
|
+ LotSize int `json:"lotsize" xorm:"-"` // 手数最小变动单位
|
|
|
+ Buymaxqty int `json:"buymaxqty" xorm:"'-'"` // 购买上限 [71] - 0为不限
|
|
|
}
|
|
|
|
|
|
// GetHsbyListingGoodsDetail 获取二级市场(挂牌点选)商品信息详情
|
|
|
// 参数 goodsID int 目标商品ID
|
|
|
// 返回 *HsbyListingGoodsDetail 二级市场(挂牌点选)商品信息详情,查询无结果返回nil
|
|
|
// 返回 error error
|
|
|
-func GetHsbyListingGoodsDetail(goodsID int) (*HsbyListingGoodsDetail, error) {
|
|
|
+func GetHsbyListingGoodsDetail(goodsID, accountID int) (*HsbyListingGoodsDetail, error) {
|
|
|
engine := db.GetEngine()
|
|
|
|
|
|
details := make([]HsbyListingGoodsDetail, 0)
|
|
|
@@ -363,9 +364,18 @@ func GetHsbyListingGoodsDetail(goodsID int) (*HsbyListingGoodsDetail, error) {
|
|
|
stepValue := float64(hsbyListingGoodsDetail.Quoteminunit) * math.Pow(0.1, float64(hsbyListingGoodsDetail.Decimalplace))
|
|
|
hsbyListingGoodsDetail.StepValue, _ = strconv.ParseFloat(utils.FormatFloat(stepValue, int(hsbyListingGoodsDetail.Decimalplace)), 64)
|
|
|
|
|
|
- // 计算手数最小变动单位
|
|
|
+ // 计算手数最小变动单位,改在上层进行设置,这里暂时设置成1
|
|
|
hsbyListingGoodsDetail.LotSize = 1
|
|
|
|
|
|
+ // 获取购买上限
|
|
|
+ if accountID != 0 {
|
|
|
+ buyMaxQty, err := GetCPTradeBuyLimit(goodsID, accountID)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ hsbyListingGoodsDetail.Buymaxqty = buyMaxQty
|
|
|
+ }
|
|
|
+
|
|
|
return &hsbyListingGoodsDetail, nil
|
|
|
}
|
|
|
|
|
|
@@ -1627,10 +1637,13 @@ type HsbyMarketGoodsDetail struct {
|
|
|
Customername string `json:"customername" xorm:"'CUSTOMERNAME'"` // 卖家名称
|
|
|
|
|
|
SellUserID int `json:"sellUserID" xorm:"SELLUSERID"` // 卖方UserID
|
|
|
+
|
|
|
+ LotSize int `json:"lotsize" xorm:"-"` // 手数最小变动单位
|
|
|
+ Buymaxqty int `json:"buymaxqty" xorm:"'-'"` // 购买上限 [71] - 0为不限
|
|
|
}
|
|
|
|
|
|
// GetHsbyMarketGoodsDetail 获取商城商品详情(三级商城)
|
|
|
-func GetHsbyMarketGoodsDetail(orderID int) (*HsbyMarketGoodsDetail, error) {
|
|
|
+func GetHsbyMarketGoodsDetail(orderID, accountID int) (*HsbyMarketGoodsDetail, error) {
|
|
|
engine := db.GetEngine()
|
|
|
|
|
|
orders := make([]HsbyMarketGoodsDetail, 0)
|
|
|
@@ -1659,6 +1672,17 @@ func GetHsbyMarketGoodsDetail(orderID int) (*HsbyMarketGoodsDetail, error) {
|
|
|
return nil, nil
|
|
|
}
|
|
|
hsbyMarketGoodsDetail := orders[0]
|
|
|
+ // 最小交易手数在上层进行设置,这里暂设置为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
|
|
|
}
|