Forráskód Böngészése

#3424 【天津麦顿-WebPC】部分场景下K线会出现显示异常的问题

zou.yingbin 3 éve
szülő
commit
55703a91e9
1 módosított fájl, 22 hozzáadás és 18 törlés
  1. 22 18
      controllers/quote/history.go

+ 22 - 18
controllers/quote/history.go

@@ -201,24 +201,28 @@ func QueryHistoryDatas(c *gin.Context) {
 						// 判断最后周期是否已经存在盘面周期
 						hd := rst[len(rst)-1]
 						if hd.TimeStamp.Before(fisrtDate) {
-							historyData := HistoryData{
-								Opened:        utils.IntToFloat64(int(v.Opened), dcplace),
-								Highest:       utils.IntToFloat64(int(v.Highest), dcplace),
-								Lowest:        utils.IntToFloat64(int(v.Lowest), dcplace),
-								Closed:        utils.IntToFloat64(int(v.Last), dcplace),
-								TotleVolume:   int(v.Totalvolume),
-								TotleTurnover: float64(v.Totalturnover),
-								HoldVolume:    int(v.Holdvolume),
-								Settle:        utils.IntToFloat64(int(v.Settle), dcplace),
-								TimeStamp:     fisrtDate,
-							}
-
-							if req.IsAsc {
-								rst = append(rst, historyData)
-							} else {
-								// 插入第一条
-								rear := append([]HistoryData{}, rst[0:]...)
-								rst = append(append(rst[:0], historyData), rear...)
+							// #3424 当日未开市显示了K线
+							// 修改:这里增加判断盘面是否有开盘价
+							if v.Opened > 0 {
+								historyData := HistoryData{
+									Opened:        utils.IntToFloat64(int(v.Opened), dcplace),
+									Highest:       utils.IntToFloat64(int(v.Highest), dcplace),
+									Lowest:        utils.IntToFloat64(int(v.Lowest), dcplace),
+									Closed:        utils.IntToFloat64(int(v.Last), dcplace),
+									TotleVolume:   int(v.Totalvolume),
+									TotleTurnover: float64(v.Totalturnover),
+									HoldVolume:    int(v.Holdvolume),
+									Settle:        utils.IntToFloat64(int(v.Settle), dcplace),
+									TimeStamp:     fisrtDate,
+								}
+
+								if req.IsAsc {
+									rst = append(rst, historyData)
+								} else {
+									// 插入第一条
+									rear := append([]HistoryData{}, rst[0:]...)
+									rst = append(append(rst[:0], historyData), rear...)
+								}
 							}
 						}
 					}