Commit acd46b01 authored by hujiebin's avatar hujiebin

script update

parent 38c09a9d
......@@ -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()
......
......@@ -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)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment