From 80257000107be6251770c4880576eb3809f076c5 Mon Sep 17 00:00:00 2001 From: dustoair <107600816+dustoair@users.noreply.github.com> Date: Sat, 17 Sep 2022 18:29:42 +0800 Subject: [PATCH] binancePrices --- api/binancePrice.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/binancePrice.go b/api/binancePrice.go index 40c8cda..c93c008 100644 --- a/api/binancePrice.go +++ b/api/binancePrice.go @@ -3,6 +3,7 @@ package api import ( "WechatGateWay/global" "github.com/jinzhu/gorm" + "log" ) /* @@ -26,12 +27,14 @@ func GetBinanceLatestPrice(symbol string) float64 { func GetBinanceLatestPrices(symbol string) []BinancePrice { var binancePrices []BinancePrice - global.DB.Where("symbol = ? order by id desc", symbol).Limit(30).Find(&binancePrices) + global.DB.Where("symbol = ? order by id desc", symbol).Find(&binancePrices) + //global.DB.Where("symbol = ? order by id desc", symbol).Limit(30).Find(&binancePrices) return binancePrices } func GetSerivers(symbol string) (timeUpdate []string, symbolPrice []float64) { binancePrices := GetBinanceLatestPrices(symbol) + log.Println("binancePrices: ", len(binancePrices)) for _, binancePrice := range binancePrices { timeUpdate = append(timeUpdate, binancePrice.UpdatedAt.Format("2006-01-02 15:04:05")) symbolPrice = append(symbolPrice, binancePrice.Price)