|
|
@@ -14,6 +14,60 @@ import (
|
|
|
"mtp2_if/utils"
|
|
|
)
|
|
|
|
|
|
+// Hedgeoutmainconfig 外部母账号对冲配置表
|
|
|
+// (要在系统参数表额外添加两个全局配置 1: 下单接口平台登录用户名[HedgePlateform_UserName] 2:下单接口平台登录密码[HedgePlateform_PWD])
|
|
|
+type Hedgeoutmainconfig struct {
|
|
|
+ Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'" binding:"required"` // 资金账号ID(母账号)
|
|
|
+ Channelid int64 `json:"channelid" xorm:"'CHANNELID'"` // 对冲渠道ID
|
|
|
+ Marketid int64 `json:"marketid" xorm:"'MARKETID'"` // 内部市场ID(母账号的操作
|
|
|
+ Hedgeaccountcode string `json:"hedgeaccountcode" xorm:"'HEDGEACCOUNTCODE'"` // 对冲账号ID
|
|
|
+ Hedgeaccountpwd string `json:"hedgeaccountpwd" xorm:"-"` // 对冲账号密码
|
|
|
+ Channeladdress string `json:"channeladdress" xorm:"'CHANNELADDRESS'"` // 对冲渠道服务地址(多个地址用逗号分隔) -- 192.168.30.10:3000,192.168.30.10:3001
|
|
|
+ Brokerid string `json:"brokerid" xorm:"'BROKERID'"` // 经纪公司代码
|
|
|
+ Exchangeratecurrencygroup string `json:"exchangeratecurrencygroup" xorm:"'EXCHANGERATECURRENCYGROUP'"` // 汇率币种组 [易盛]
|
|
|
+ Accountcurrency string `json:"accountcurrency" xorm:"'ACCOUNTCURRENCY'"` // 资金账户基币 [易盛]
|
|
|
+ Accountcurrecnygroup string `json:"accountcurrecnygroup" xorm:"'ACCOUNTCURRECNYGROUP'"` // 资金账户币种组 [易盛]
|
|
|
+ Authcode string `json:"authcode" xorm:"'AUTHCODE'"` // 授权码[易盛]
|
|
|
+ Status int32 `json:"status" xorm:"'STATUS'"` // 渠道账号状态 1-可买入可卖出 2-可卖出不可买入
|
|
|
+ Limitnumber int64 `json:"limitnumber" xorm:"'LIMITNUMBER'"` // 挂单笔数限额
|
|
|
+ Appid string `json:"appid" xorm:"'APPID'"` // AppID
|
|
|
+ Userproductinfo string `json:"userproductinfo" xorm:"'USERPRODUCTINFO'"` // 客户端产品信息
|
|
|
+ Connectflag int32 `json:"connectflag" xorm:"'CONNECTFLAG'"` // 是否联接外部交易 - 0:不连接 1:连接
|
|
|
+ Hedgeaccounttype int32 `json:"hedgeaccounttype" xorm:"'HEDGEACCOUNTTYPE'"` // 母账号类型 - 1-交易下单 2-跟单
|
|
|
+ Fcid int32 `json:"fcid" xorm:"'FCID'"` // 期货公司ID
|
|
|
+}
|
|
|
+
|
|
|
+// TableName is HEDGE_OUTMAINCONFIG
|
|
|
+func (Hedgeoutmainconfig) TableName() string {
|
|
|
+ return "HEDGE_OUTMAINCONFIG"
|
|
|
+}
|
|
|
+
|
|
|
+// GetOutAccountStatus 获取目标登录账号当前对冲账号在线状态
|
|
|
+func (r *Hedgeoutmainconfig) GetOutAccountStatus(loginID int) ([]Hedgeoutmainconfig, error) {
|
|
|
+ datas := make([]Hedgeoutmainconfig, 0)
|
|
|
+
|
|
|
+ // 获取登录账号相关的所有资金账户
|
|
|
+ taAccounts, err := GetTaAccountsByLoginID(loginID, 0)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ ids := make([]int, 0)
|
|
|
+ for _, v := range taAccounts {
|
|
|
+ if v.Ismain == 1 {
|
|
|
+ // 母账户
|
|
|
+ ids = append(ids, int(v.Accountid))
|
|
|
+ } else {
|
|
|
+ // 子账户
|
|
|
+ ids = append(ids, int(v.Parentaccountid))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if err := db.GetEngine().In("ACCOUNTID", ids).Find(&datas); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return datas, nil
|
|
|
+}
|
|
|
+
|
|
|
// ErmcpUserModel 客户资料结构
|
|
|
type ErmcpUserModel struct {
|
|
|
USERID int `json:"userid" xorm:"'USERID'"` // 用户ID
|