package api import ( "WechatGateWay/global" "github.com/jinzhu/gorm" ) /** @author: sre @date: 2022/9/12 0012 @desc: todo **/ type BinancePrice struct { gorm.Model Symbol string Price float64 } func GetBinanceLatestPrice(symbol string) float64 { var binancePrice BinancePrice global.DB.Where("symbol = ?", symbol).Last(&binancePrice) return binancePrice.Price } type CMBGold struct { gorm.Model Variety string CurPrice float64 UpDown float64 GoldNo string } func GetCMBGoldLatestPrice(goldNo string) float64 { var cmbGold CMBGold global.DB.Where("gold_no = ?", goldNo).Last(&cmbGold) return cmbGold.CurPrice }