黄金价格
continuous-integration/drone/push Build is passing Details

master
dustoair 3 years ago
parent 35cb021adf
commit 5ca677c95b

@ -0,0 +1,31 @@
package api
import (
"WechatGateWay/global"
"github.com/jinzhu/gorm"
)
/*
*
@author: sre
@date: 2022/9/12 0012
@desc: todo
*
*/
type BaiduReportInfo struct {
gorm.Model
siteId int64
Domain string
YesterdayPvCount int
YesterdayVisitorCount int
YesterdayIpCount int
TodayPvCount int
TodayVisitorCount int
TodayIpCount int
}
func GetLatestBaiduReportInfo(domain string) (int, int, int) {
var baiduReportInfo BaiduReportInfo
global.DB.Where("domain = ?", domain).Last(&baiduReportInfo)
return baiduReportInfo.TodayPvCount, baiduReportInfo.TodayVisitorCount, baiduReportInfo.TodayIpCount
}

@ -0,0 +1,25 @@
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
}

@ -5,24 +5,13 @@ import (
"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

@ -13,4 +13,5 @@ var CMDList = []string{
"虚拟货币",
"gold",
"黄金",
"ip",
}

@ -46,6 +46,10 @@ func cmdExec(msgContent MsgContent) (replyContent string) {
goldPrice := api.GetCMBGoldLatestPrice("AU100G")
replyContent = fmt.Sprintf("黄金价格: %f", goldPrice)
return
case "ip", "百度统计":
todayPvCount, todayVisitorCount, todayIpCount := api.GetLatestBaiduReportInfo("sre.ink")
replyContent = fmt.Sprintf("今日百度统计: PV %d, VC %d IP %d", todayPvCount, todayVisitorCount, todayIpCount)
return
default:
cmdString = msgContent.Content
}

Loading…
Cancel
Save