zhou.xiaoning vor 3 Jahren
Ursprung
Commit
855454afc3
2 geänderte Dateien mit 17 neuen und 7 gelöschten Zeilen
  1. 6 6
      config/config.xml
  2. 11 1
      models/ermcp8.go

+ 6 - 6
config/config.xml

@@ -13,11 +13,11 @@
     <DbAddress value="192.168.31.88"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test137"/>
+    <DbUser value="mtp2_test203"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>
-    <Address value="192.168.31.137"/>
+    <Address value="192.168.31.203"/>
     <Port value="5007"/>
     <Timeout value="3"/>
     <ConnNum value="1"/>
@@ -25,11 +25,11 @@
     <Pwd value=""/>
   </RedisSetting>
   <MqSetting>
-    <Url value="amqp://guest:guest@192.168.31.137:5020/test"/>
+    <Url value="amqp://guest:guest@192.168.31.203:5020/test"/>
     <Exchange value="entry"/>
   </MqSetting>
   <MongoDBSetting>
-    <HostName value="192.168.31.137"/>
+    <HostName value="192.168.31.203"/>
     <Port value="5025"/>
     <DBName value="HistoryQuote"/>
     <Username value="quote_test01"/>
@@ -38,8 +38,8 @@
   <MySQLSetting>
     <Host value="192.168.30.72"/>
     <Port value="3306"/>
-    <DBName value="historyquote_test137"/>
-    <Username value="quote_test137"/>
+    <DBName value="historyquote_test203"/>
+    <Username value="quote_test203"/>
     <Password value="123456"/>
   </MySQLSetting>
 </Configuration>

+ 11 - 1
models/ermcp8.go

@@ -8,6 +8,7 @@ import (
 	"mtp2_if/pb"
 	"mtp2_if/rediscli"
 	"mtp2_if/utils"
+	"sort"
 	"strconv"
 	"strings"
 	"time"
@@ -1450,6 +1451,12 @@ type Ermcp8RunningHedgeditem struct {
 	USERID int64 `json:"-" form:"userid" binding:"required"` // 用户id, 用于过滤
 }
 
+type Ermcp8RunningHedgeditems []Ermcp8RunningHedgeditem
+
+func (s Ermcp8RunningHedgeditems) Len() int           { return len(s) }
+func (s Ermcp8RunningHedgeditems) Less(i, j int) bool { return s[i].Createtime < s[j].Createtime }
+func (s Ermcp8RunningHedgeditems) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
+
 func (r *Ermcp8RunningHedgeditem) ParseFromProto(p *pb.Ermcp2HedgedItemInfo) {
 	r.Hedgeditemid = strconv.Itoa(int(*p.Hedgeditemext.Item.HedgedItemID))
 	r.Hedgeditemnum = p.Hedgeditemext.Item.GetHedgedItemNum()
@@ -1578,6 +1585,8 @@ func (r *Ermcp8RunningHedgeditem) GetDataEx(userID int) (interface{}, error) {
 			}
 		}
 	}
+	// 按Updatetime倒序排序
+	sort.Sort(sort.Reverse(Ermcp8RunningHedgeditems(sData)))
 
 	return sData, nil
 }
@@ -1998,7 +2007,8 @@ func (r *Unlinkermcphedgeplan) buildSql() string {
 		wr.WRSTANDARDNAME,
 		t.PLANQTY,
 		e.ENUMDICNAME,
-		t.HEDGEPLANSTATUS
+		t.HEDGEPLANSTATUS,
+		t.WRSTANDARDID
 	FROM ERMCP_HedgePlan t
 	LEFT JOIN USERACCOUNT u on u.userid = t.tradeuserid
 	LEFT JOIN WRStandard wr ON wr.wrstandardid = t.wrstandardid