Procházet zdrojové kódy

Merge branch 'master' of 192.168.30.132:MTP2.0/MTP20_IF

zhou.xiaoning před 4 roky
rodič
revize
1d4f0f2635
2 změnil soubory, kde provedl 9 přidání a 12 odebrání
  1. 8 11
      models/tjmd.go
  2. 1 1
      models/wrTrade2.go

+ 8 - 11
models/tjmd.go

@@ -230,20 +230,17 @@ func (r *TjmdTodayAccountMargin) calc() {
 
 func (r *TjmdTodayAccountMargin) buildSql() string {
 	var sqlId utils.SQLVal = `
-select *
-  from (select t.accountid,
-               t.goodsid,
-               t.infocontent,
-               t.marketid,
-               row_number() over(partition by t.goodsid, t.marketid order by t.accountid desc) cnt
-          from today_accountmargin t) a
- where a.cnt = 1
+select t.accountid, t.goodsid, t.infocontent, t.createdate, t.marketid
+  from today_accountmargin t
+ where 1 = 1
 `
 	if r.ACCOUNTID > 0 {
-		sqlId.JoinFormat(" and a.ACCOUNTID in(0, %v)", r.ACCOUNTID)
+		sqlId.JoinFormat(" and t.ACCOUNTID in(0, %v)", r.ACCOUNTID)
 	}
-	sqlId.AndEx("a.GOODSID", r.GOODSID, r.GOODSID > 0)
-	sqlId.AndEx("a.MARKETID", r.MARKETID, r.MARKETID > 0)
+	sqlId.AndEx("t.GOODSID", r.GOODSID, r.GOODSID > 0)
+	sqlId.AndEx("t.MARKETID", r.MARKETID, r.MARKETID > 0)
+	sqlId.Join(" order by t.accountid desc")
+	sqlId.Page(1, 1) // 只取一条
 	return sqlId.String()
 }
 

+ 1 - 1
models/wrTrade2.go

@@ -1115,7 +1115,7 @@ type WrGoodsPerformanceStep struct {
 func (r *WrGoodsPerformanceStep) calc() {
 	switch r.STEPTYPEID {
 	case 1, 2, 98:
-		v := SFLOAT64(r.STEPVALUE * 100)
+		v := r.STEPVALUE * 100
 		v.Round(8) // fix bug: 0.56 * 100 之后变为 0.560000000001, 把后面多余的1去掉
 		r.STEPINFO = fmt.Sprintf("%v %v%%", r.STEPTYPENAME, v.string())
 	case 92: