, timestamp, nonce string, w http.ResponseWriter
continuous-integration/drone/push Build is passing Details

master
dustoair 3 years ago
parent b66b319e15
commit 153b7ac6c4

3
.gitignore vendored

@ -11,4 +11,5 @@ cert
challenge
.env
application.yaml
nogit_test.go
nogit_test.go
/goCharts/tmp/

@ -52,15 +52,6 @@ func Draw() {
330,
320,
},
{
820,
932,
901,
934,
1290,
1330,
1320,
},
}
p, err := charts.LineRender(
values,
@ -68,7 +59,7 @@ func Draw() {
charts.ThemeOptionFunc(charts.ThemeGrafana),
charts.WidthOptionFunc(720),
charts.HeightOptionFunc(1280),
charts.TitleTextOptionFunc("Line"),
charts.TitleTextOptionFunc("symbol price"),
charts.XAxisDataOptionFunc([]string{
"Mon",
"Tue",
@ -79,12 +70,11 @@ func Draw() {
"Sun",
}),
charts.LegendLabelsOptionFunc([]string{
"Email",
"Union Ads",
"Video Ads",
"Direct",
"Search Engine",
}, "50"),
"BTC",
"ETH",
"BNB",
"TRX",
}, "150"),
func(opt *charts.ChartOption) {
opt.Legend.Padding = charts.Box{
Top: 5,

@ -0,0 +1,14 @@
package goCharts
import "testing"
/*
*
@author: sre
@date: 2022/9/17 0017
@desc: todo
*
*/
func TestDraw(t *testing.T) {
Draw()
}

@ -8,7 +8,7 @@ import (
"net/http"
)
func replyImage(msgContent MsgContent, timestamp, nonce string, w http.ResponseWriter) {
func replyImageDraw(msgContent MsgContent, timestamp, nonce string, w http.ResponseWriter) {
//third_part.SendPicMid(msgContent.FromUsername, utils.RandMapValue(global.ImageMap))
goCharts.Draw()
filename := "tmp/line-chart.png"
@ -16,7 +16,7 @@ func replyImage(msgContent MsgContent, timestamp, nonce string, w http.ResponseW
third_part.SendPicFile(msgContent.FromUsername, filename)
}
func replyImageEmoj(msgContent MsgContent, timestamp, nonce string, w http.ResponseWriter) {
func replyImage(msgContent MsgContent, timestamp, nonce string, w http.ResponseWriter) {
//third_part.SendPicMid(msgContent.FromUsername, utils.RandMapValue(global.ImageMap))
filename := global.WechatImagePath + "/" + utils.RandomFile(global.WechatImagePath)
go RecordWechatLog(msgContent.FromUsername, msgContent.ToUsername, msgContent.CreateTime, msgContent.MsgType, filename)

@ -12,7 +12,7 @@ import (
)
// cmdExec 根据白名单命令来执行
func cmdExec(msgContent MsgContent) (replyContent string) {
func cmdExec(msgContent MsgContent, timestamp, nonce string, w http.ResponseWriter) (replyContent string) {
var cmdString string
switch msgContent.Content {
case "last":
@ -42,6 +42,7 @@ func cmdExec(msgContent MsgContent) (replyContent string) {
priceTRX := api.GetBinanceLatestPrice("TRXUSDT")
priceBNB := api.GetBinanceLatestPrice("BNBUSDT")
replyContent = fmt.Sprintf("BTC价格: %f \nETH价格: %f \nTRX价格: %f \nBNB价格: %f", priceBTC, priceETH, priceTRX, priceBNB)
replyImageDraw(msgContent, timestamp, nonce, w)
return
case "gold", "黄金":
@ -88,7 +89,7 @@ func replyText(msgContent MsgContent, timestamp, nonce string, w http.ResponseWr
if global.EnableCmdExec && utils.SliceContain(global.CMDList, msgContent.Content) && msgContent.FromUsername == "QiaoYang" {
//开启了命令执行功能,并且消息内容包含了命令
log.Println("收到命令消息")
replyContent = cmdExec(msgContent)
replyContent = cmdExec(msgContent, timestamp, nonce, w)
} else {
log.Println("ai msg")
replyContent = aiReply(msgContent)

Loading…
Cancel
Save