|
|
@@ -301,6 +301,7 @@ type HybsMyBuyOrderDetail struct {
|
|
|
Listingselecttype int32 `json:"listingselecttype" xorm:"'LISTINGSELECTTYPE'"` // 挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂
|
|
|
Orderstatus int32 `json:"orderstatus" xorm:"'ORDERSTATUS'"` // 委托状态 - 1: 委托请求 2:待冻结 3:委托成功 4: 委托失败 5:配对成功 6: 已撤销 7:部分成交 8:已成交 9:部成部撤 10:成交失败 11:已拒绝 12:经过摘牌(先摘后挂专用-先摘后挂已摘过) 13:冻结成功(通道交易专用) 14:通道已撤 15:通道部成部撤 16:成交失败违约(荷兰式竞拍专用)
|
|
|
|
|
|
+ Goodscode string `json:"goodscode" xorm:"'GOODSCODE'" binding:"required"` // 商品代码(内部)
|
|
|
Goodsname string `json:"goodsname" xorm:"'GOODSNAME'" binding:"required"` // 商品名称
|
|
|
Decimalplace int64 `json:"decimalplace" xorm:"'DECIMALPLACE'"` // 报价小数位
|
|
|
|
|
|
@@ -316,19 +317,18 @@ type HybsMyBuyOrderDetail struct {
|
|
|
}
|
|
|
|
|
|
// GetHsbyBuyMyOrderDetails 获取“我的订单”数据(包括一二级市场)
|
|
|
-// 输入 accountID int 资金账户
|
|
|
+// 输入 accountIDs string 资金账户列表
|
|
|
// 输入 myBuyStatus int "我的订单"状态, 1:抢购中 2:求购中 3:已完成
|
|
|
// 输出 []HybsMyBuyOrderDetail “我的订单”数据
|
|
|
// 输出 error error
|
|
|
-func GetHsbyBuyMyOrderDetails(accountID, myBuyStatus int) ([]HybsMyBuyOrderDetail, error) {
|
|
|
- engine := db.GetEngine()
|
|
|
-
|
|
|
+func GetHsbyBuyMyOrderDetails(accountIDs string, myBuyStatus int) ([]HybsMyBuyOrderDetail, error) {
|
|
|
// 获取市场信息
|
|
|
markets, err := GetMarkets()
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
+ engine := db.GetEngine()
|
|
|
// 委托状态
|
|
|
orderStatus := "0" // 单据状态,为0的时候查询全部
|
|
|
marketID := 0 // 我的订单包括一二级市场的单据,目前暂时由服务直接报相关类型的第一个市场
|
|
|
@@ -358,7 +358,7 @@ func GetHsbyBuyMyOrderDetails(accountID, myBuyStatus int) ([]HybsMyBuyOrderDetai
|
|
|
hybsMyBuyOrderDetails := make([]HybsMyBuyOrderDetail, 0)
|
|
|
session := engine.Table("TRADE_ORDERDETAIL").
|
|
|
Select(`TRADE_ORDERDETAIL.*,
|
|
|
- GOODS.GOODSNAME, GOODS.DECIMALPLACE,
|
|
|
+ GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE,
|
|
|
HSBY_GOODSEX.PICURLS,
|
|
|
MARKET.TRADEMODE,
|
|
|
ENUMDICITEM.PARAM2 CURRENCYSIGN,
|
|
|
@@ -368,7 +368,7 @@ func GetHsbyBuyMyOrderDetails(accountID, myBuyStatus int) ([]HybsMyBuyOrderDetai
|
|
|
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)
|
|
|
+ Where(fmt.Sprintf("TRADE_ORDERDETAIL.ACCOUNTID in (%s)", accountIDs))
|
|
|
// 是否过滤市场(抢购中、求购中)
|
|
|
if marketID > 0 {
|
|
|
session = session.And("TRADE_ORDERDETAIL.MARKETID = ?", marketID)
|
|
|
@@ -405,3 +405,42 @@ func GetHsbyBuyMyOrderDetails(accountID, myBuyStatus int) ([]HybsMyBuyOrderDetai
|
|
|
|
|
|
return hybsMyBuyOrderDetails, nil
|
|
|
}
|
|
|
+
|
|
|
+// HsbyMyGoods 我的商品(买方向持仓)
|
|
|
+type HsbyMyGoods struct {
|
|
|
+ Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'" binding:"required"` // 账号Id
|
|
|
+ Goodsid int32 `json:"goodsid" xorm:"'GOODSID'" binding:"required"` // 商品Id
|
|
|
+ Buycurpositionqty int64 `json:"buycurpositionqty" xorm:"'BUYCURPOSITIONQTY'"` // 买当前持仓总数量
|
|
|
+ Buycurholderamount float64 `json:"buycurholderamount" xorm:"'BUYCURHOLDERAMOUNT'"` // 买当前持仓总金额[商品币种]
|
|
|
+
|
|
|
+ Goodscode string `json:"goodscode" xorm:"'GOODSCODE'" binding:"required"` // 商品代码(内部)
|
|
|
+ Goodsname string `json:"goodsname" xorm:"'GOODSNAME'" binding:"required"` // 商品名称
|
|
|
+ Decimalplace int64 `json:"decimalplace" xorm:"'DECIMALPLACE'"` // 报价小数位
|
|
|
+
|
|
|
+ Picurls string `json:"picurls" xorm:"'PICURLS'"` // 介绍图片[多张用逗号分隔]
|
|
|
+
|
|
|
+ Currencysign string `json:"currencysign" xorm:"'CURRENCYSIGN'"` // 货币符号
|
|
|
+}
|
|
|
+
|
|
|
+// GetHsbyMyGoods 获取“我的商品”信息
|
|
|
+// 输入 accountIDs string 资金账户列表,格式 1,2,3
|
|
|
+// 输出 []HsbyMyGoods “我的商品”信息
|
|
|
+// 输入 error error
|
|
|
+func GetHsbyMyGoods(accountIDs string) ([]HsbyMyGoods, error) {
|
|
|
+ engine := db.GetEngine()
|
|
|
+
|
|
|
+ hsbyMyGoodses := make([]HsbyMyGoods, 0)
|
|
|
+ if err := engine.Table("TRADEPOSITION").
|
|
|
+ Select(`TRADEPOSITION.*,
|
|
|
+ GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE,
|
|
|
+ HSBY_GOODSEX.PICURLS,
|
|
|
+ ENUMDICITEM.PARAM2 CURRENCYSIGN`).
|
|
|
+ Join("LEFT", "GOODS", "GOODS.GOODSID = TRADEPOSITION.GOODSID").
|
|
|
+ Join("LEFT", "HSBY_GOODSEX", "HSBY_GOODSEX.GOODSID = GOODS.GOODSID").
|
|
|
+ Join("LEFT", "ENUMDICITEM", "GOODS.CURRENCYID = ENUMDICITEM.ENUMITEMNAME and ENUMDICITEM.ENUMDICCODE = 'currency'").
|
|
|
+ Where(fmt.Sprintf("TRADEPOSITION.ACCOUNTID in (%s)", accountIDs)).Find(&hsbyMyGoodses); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return hsbyMyGoodses, nil
|
|
|
+}
|