From acd46b011a495e77ae363a424838e95d60e63d5e Mon Sep 17 00:00:00 2001 From: hujiebin Date: Wed, 23 Aug 2023 12:00:18 +0800 Subject: [PATCH] script update --- script/fruit_day_award.go | 4 ++-- script/test_game_banner.go | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/script/fruit_day_award.go b/script/fruit_day_award.go index 416cd0d..b546f15 100644 --- a/script/fruit_day_award.go +++ b/script/fruit_day_award.go @@ -41,7 +41,7 @@ func ats32(a interface{}) string { } func main() { - url := "https://apiv2.faceline.live/v1/fruitMachine/rank/award?lang=zh-cn&pageIndex=1&pageSize=50000&beginDate=2023-08-20&endDate=2023-08-20&userCode=&timezone=1" + url := "https://apiv2.faceline.live/v1/fruitMachine/rank/award?lang=zh-cn&pageIndex=1&pageSize=5000&beginDate=2023-08-21&endDate=2023-08-21&userCode=&timezone=1" method := "GET" client := &http.Client{} @@ -95,7 +95,7 @@ func main() { for _, v := range svips { svipMap[v.Code] = v.Level } - excelFileName := fmt.Sprintf("./0820水果机中奖榜.xlsx") + excelFileName := fmt.Sprintf("./0821水果机中奖榜.xlsx") xlFile := xlsx.NewFile() sheet, _ := xlFile.AddSheet("charge") row := sheet.AddRow() diff --git a/script/test_game_banner.go b/script/test_game_banner.go index 2e6761c..adf5c98 100644 --- a/script/test_game_banner.go +++ b/script/test_game_banner.go @@ -5,6 +5,8 @@ import ( "git.hilo.cn/hilo-common/script/mysql" ) +// cat 146.json | grep 'gameId\\"\:17' | wc -l +// 如果mysql navicate中导出json,可以用上面的命令,是准确的。 type RpcLog struct { Type int Msg string @@ -12,18 +14,20 @@ type RpcLog struct { type Msg struct { GameType int `json:"gameType"` + GameId int `json:"gameId"` } var GameTypeMap = map[int]string{ - 0: "slot", - 5: "幸运盒子", - 6: "水果机", + //0: "slot", + //5: "幸运盒子", + //6: "水果机", + 17: "赛车", } func main() { var rpcLogs []RpcLog - if err := mysql.ProdReadOnlyDB.Table("rpc_log_202303 ").Where("`type` = 146"). - Where("created_time >= ? and created_time < ?", "2023-03-09", "2023-03-13").Find(&rpcLogs).Error; err != nil { + if err := mysql.ProdReadOnlyDB.Table("rpc_log_202308").Where("`type` = 146"). + Where("created_time >= ?", "2023-08-22 15:57:49").Find(&rpcLogs).Error; err != nil { panic(err) } var data = make(map[int]int) @@ -32,9 +36,9 @@ func main() { if err := json.Unmarshal([]byte(log.Msg), msg); err != nil { panic(err) } - data[msg.GameType]++ + data[msg.GameId]++ } - for gameType, count := range data { - println(GameTypeMap[gameType], count) + for gameId, count := range data { + println(GameTypeMap[gameId], count) } } -- 2.22.0