|
|
@@ -1403,6 +1403,7 @@ type GetTodayAccountConfigInfoRsp struct {
|
|
|
TodayAccountMargins []Todayaccountmargin `json:"todayAccountMargins"` // 今日账户保证金表
|
|
|
TodayAccountTradefees []Todayaccounttradefee `json:"todayAccountTradefees"` // 今日账户交易费用表
|
|
|
TodayAccountTradeRules []Todayaccounttraderule `json:"todayAccountTradeRules"` // 今日账户交易规则信表
|
|
|
+ RiskRatioType *Riskratiotype `json:"riskRatioType"` // 风险率类型表
|
|
|
}
|
|
|
|
|
|
func GetTodayAccountConfigInfo(accountid int) (rsp GetTodayAccountConfigInfoRsp, err error) {
|
|
|
@@ -1419,11 +1420,19 @@ func GetTodayAccountConfigInfo(accountid int) (rsp GetTodayAccountConfigInfoRsp,
|
|
|
if err = db.GetEngine().In("ACCOUNTID", []int{0, accountid}).Find(&todayAccountTradefees); err != nil {
|
|
|
return
|
|
|
}
|
|
|
+ for i := range todayAccountTradefees {
|
|
|
+ item := &todayAccountTradefees[i]
|
|
|
+ item.INFOCONTENT = base64.StdEncoding.EncodeToString([]byte(item.INFOCONTENT))
|
|
|
+ }
|
|
|
|
|
|
todayAccountTradeRules := make([]Todayaccounttraderule, 0)
|
|
|
if err = db.GetEngine().In("ACCOUNTID", []int{0, accountid}).Find(&todayAccountTradeRules); err != nil {
|
|
|
return
|
|
|
}
|
|
|
+ for i := range todayAccountTradeRules {
|
|
|
+ item := &todayAccountTradeRules[i]
|
|
|
+ item.INFOCONTENT = base64.StdEncoding.EncodeToString([]byte(item.INFOCONTENT))
|
|
|
+ }
|
|
|
|
|
|
rsp = GetTodayAccountConfigInfoRsp{
|
|
|
TodayAccountMargins: todayAccountMargins,
|
|
|
@@ -1431,5 +1440,54 @@ func GetTodayAccountConfigInfo(accountid int) (rsp GetTodayAccountConfigInfoRsp,
|
|
|
TodayAccountTradeRules: todayAccountTradeRules,
|
|
|
}
|
|
|
|
|
|
+ sql := fmt.Sprintf(`
|
|
|
+ SELECT TA.ACCOUNTID,
|
|
|
+ NVL(NVL(NVL(UG.CUSTOMERTYPE, ARC.CUSTOMERTYPE), CTAD.CUSTOMERTYPE),
|
|
|
+ -1) AS RISKID
|
|
|
+ FROM TAACCOUNT TA
|
|
|
+ LEFT JOIN USERACCOUNT UA
|
|
|
+ ON UA.USERID = TA.USERID
|
|
|
+ LEFT JOIN USERGROUPDETAIL UGD
|
|
|
+ ON TA.USERID = UGD.USERID
|
|
|
+ LEFT JOIN USERGROUP UG
|
|
|
+ ON UGD.USERGROUPID = UG.AUTOID
|
|
|
+ LEFT JOIN ACCOUNTRISKCONFIG ARC
|
|
|
+ ON ARC.ACCOUNTID = TA.ACCOUNTID
|
|
|
+ LEFT JOIN CUSTOMERTYPEAREADETAIL CTAD
|
|
|
+ ON TA.USERID = CTAD.USERID
|
|
|
+ WHERE
|
|
|
+ TA.TAACCOUNTTYPE IN (2)
|
|
|
+ AND TA.ACCOUNTID = %v
|
|
|
+ `, accountid)
|
|
|
+ results, err := db.GetEngine().QueryInterface(sql)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(results) > 0 {
|
|
|
+ if riskid, ok := results[0]["RISKID"].(float64); ok {
|
|
|
+ if riskid == -1 {
|
|
|
+ var riskatiotype Riskratiotype
|
|
|
+ if ok, err = db.GetEngine().Where("riskcontrolmode = 1 and isdefault = 1").Get(&riskatiotype); err == nil && ok {
|
|
|
+ rsp.RiskRatioType = new(Riskratiotype)
|
|
|
+ *rsp.RiskRatioType = riskatiotype
|
|
|
+ } else {
|
|
|
+ if err == nil {
|
|
|
+ err = errors.New("获取数据失败")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ var riskatiotype Riskratiotype
|
|
|
+ if ok, err = db.GetEngine().Where("CUSTOMERTYPE = ?", riskid).Get(&riskatiotype); err == nil && ok {
|
|
|
+ rsp.RiskRatioType = new(Riskratiotype)
|
|
|
+ *rsp.RiskRatioType = riskatiotype
|
|
|
+ } else {
|
|
|
+ if err == nil {
|
|
|
+ err = errors.New("获取数据失败")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return
|
|
|
}
|