diff --git a/script/act_rank_data.go b/script/act_rank_data.go new file mode 100644 index 0000000000000000000000000000000000000000..edebf9182a8972a74de86ffe490a86ee51716221 --- /dev/null +++ b/script/act_rank_data.go @@ -0,0 +1,227 @@ +package main + +import ( + "encoding/json" + "fmt" + "github.com/spf13/cast" + "github.com/tealeg/xlsx" + "io/ioutil" + "net/http" + "time" +) + +type ActRankData struct { + Code int `json:"code,omitempty"` + Message string `json:"message,omitempty"` + MessageData any `json:"messageData,omitempty"` + OperationMessage string `json:"operationMessage,omitempty"` + Data struct { + Top3 []struct { + ID int `json:"id,omitempty"` + CreatedTime time.Time `json:"createdTime,omitempty"` + UpdatedTime time.Time `json:"updatedTime,omitempty"` + ExternalID string `json:"externalId,omitempty"` + Avatar string `json:"avatar,omitempty"` + DefaultAvatar bool `json:"defaultAvatar,omitempty"` + Nick string `json:"nick,omitempty"` + Sex int `json:"sex,omitempty"` + Birthday int `json:"birthday,omitempty"` + Country string `json:"country,omitempty"` + CountryIcon string `json:"countryIcon,omitempty"` + Language string `json:"language,omitempty"` + Description string `json:"description,omitempty"` + Code string `json:"code,omitempty"` + OriginCode string `json:"originCode,omitempty"` + IsPush int `json:"isPush,omitempty"` + IsShowAge int `json:"isShowAge,omitempty"` + Status int `json:"status,omitempty"` + DeviceType string `json:"deviceType,omitempty"` + LogoutTime int `json:"logoutTime,omitempty"` + MaskNick string `json:"maskNick,omitempty"` + MaskAvatar string `json:"maskAvatar,omitempty"` + CountryID bool `json:"countryId,omitempty"` + IsRealCertification int `json:"isRealCertification,omitempty"` + Rank int `json:"Rank,omitempty"` + Score int `json:"Score,omitempty"` + User2 struct { + ID int `json:"id,omitempty"` + CreatedTime time.Time `json:"createdTime,omitempty"` + UpdatedTime time.Time `json:"updatedTime,omitempty"` + ExternalID string `json:"externalId,omitempty"` + Avatar string `json:"avatar,omitempty"` + DefaultAvatar bool `json:"defaultAvatar,omitempty"` + Nick string `json:"nick,omitempty"` + Sex int `json:"sex,omitempty"` + Birthday int `json:"birthday,omitempty"` + Country string `json:"country,omitempty"` + CountryIcon string `json:"countryIcon,omitempty"` + Language string `json:"language,omitempty"` + Description string `json:"description,omitempty"` + Code string `json:"code,omitempty"` + OriginCode string `json:"originCode,omitempty"` + IsPush int `json:"isPush,omitempty"` + IsShowAge int `json:"isShowAge,omitempty"` + Status int `json:"status,omitempty"` + DeviceType string `json:"deviceType,omitempty"` + LogoutTime int `json:"logoutTime,omitempty"` + MaskNick string `json:"maskNick,omitempty"` + MaskAvatar string `json:"maskAvatar,omitempty"` + CountryID bool `json:"countryId,omitempty"` + IsRealCertification int `json:"isRealCertification,omitempty"` + } `json:"User2,omitempty"` + Supporter any `json:"supporter,omitempty"` + Family any `json:"Family,omitempty"` + TodayScore int `json:"TodayScore,omitempty"` + Today string `json:"Today,omitempty"` + } `json:"top3,omitempty"` + List []struct { + ID int `json:"id,omitempty"` + CreatedTime time.Time `json:"createdTime,omitempty"` + UpdatedTime time.Time `json:"updatedTime,omitempty"` + ExternalID string `json:"externalId,omitempty"` + Avatar string `json:"avatar,omitempty"` + DefaultAvatar bool `json:"defaultAvatar,omitempty"` + Nick string `json:"nick,omitempty"` + Sex int `json:"sex,omitempty"` + Birthday int `json:"birthday,omitempty"` + Country string `json:"country,omitempty"` + CountryIcon string `json:"countryIcon,omitempty"` + Language string `json:"language,omitempty"` + Description string `json:"description,omitempty"` + Code string `json:"code,omitempty"` + OriginCode string `json:"originCode,omitempty"` + IsPush int `json:"isPush,omitempty"` + IsShowAge int `json:"isShowAge,omitempty"` + Status int `json:"status,omitempty"` + DeviceType string `json:"deviceType,omitempty"` + LogoutTime int `json:"logoutTime,omitempty"` + MaskNick string `json:"maskNick,omitempty"` + MaskAvatar string `json:"maskAvatar,omitempty"` + CountryID bool `json:"countryId,omitempty"` + IsRealCertification int `json:"isRealCertification,omitempty"` + Rank int `json:"Rank,omitempty"` + Score int `json:"Score,omitempty"` + User2 struct { + ID int `json:"id,omitempty"` + CreatedTime time.Time `json:"createdTime,omitempty"` + UpdatedTime time.Time `json:"updatedTime,omitempty"` + ExternalID string `json:"externalId,omitempty"` + Avatar string `json:"avatar,omitempty"` + DefaultAvatar bool `json:"defaultAvatar,omitempty"` + Nick string `json:"nick,omitempty"` + Sex int `json:"sex,omitempty"` + Birthday int `json:"birthday,omitempty"` + Country string `json:"country,omitempty"` + CountryIcon string `json:"countryIcon,omitempty"` + Language string `json:"language,omitempty"` + Description string `json:"description,omitempty"` + Code string `json:"code,omitempty"` + OriginCode string `json:"originCode,omitempty"` + IsPush int `json:"isPush,omitempty"` + IsShowAge int `json:"isShowAge,omitempty"` + Status int `json:"status,omitempty"` + DeviceType string `json:"deviceType,omitempty"` + LogoutTime int `json:"logoutTime,omitempty"` + MaskNick string `json:"maskNick,omitempty"` + MaskAvatar string `json:"maskAvatar,omitempty"` + CountryID bool `json:"countryId,omitempty"` + IsRealCertification int `json:"isRealCertification,omitempty"` + } `json:"User2,omitempty"` + Supporter any `json:"supporter,omitempty"` + Family any `json:"Family,omitempty"` + TodayScore int `json:"TodayScore,omitempty"` + Today string `json:"Today,omitempty"` + } `json:"List,omitempty"` + OrdinaryTop5 any `json:"OrdinaryTop5,omitempty"` + Mine struct { + ID int `json:"id,omitempty"` + CreatedTime time.Time `json:"createdTime,omitempty"` + UpdatedTime time.Time `json:"updatedTime,omitempty"` + ExternalID string `json:"externalId,omitempty"` + Avatar string `json:"avatar,omitempty"` + DefaultAvatar bool `json:"defaultAvatar,omitempty"` + Nick string `json:"nick,omitempty"` + Sex int `json:"sex,omitempty"` + Birthday int `json:"birthday,omitempty"` + Country string `json:"country,omitempty"` + CountryIcon string `json:"countryIcon,omitempty"` + Language string `json:"language,omitempty"` + Description string `json:"description,omitempty"` + Code string `json:"code,omitempty"` + OriginCode string `json:"originCode,omitempty"` + IsPush int `json:"isPush,omitempty"` + IsShowAge int `json:"isShowAge,omitempty"` + Status int `json:"status,omitempty"` + DeviceType string `json:"deviceType,omitempty"` + LogoutTime int `json:"logoutTime,omitempty"` + MaskNick string `json:"maskNick,omitempty"` + MaskAvatar string `json:"maskAvatar,omitempty"` + CountryID bool `json:"countryId,omitempty"` + IsRealCertification int `json:"isRealCertification,omitempty"` + Rank int `json:"Rank,omitempty"` + Score int `json:"Score,omitempty"` + User2 any `json:"User2,omitempty"` + Supporter any `json:"supporter,omitempty"` + Family any `json:"Family,omitempty"` + TodayScore int `json:"TodayScore,omitempty"` + Today string `json:"Today,omitempty"` + } `json:"Mine,omitempty"` + TeamList any `json:"TeamList,omitempty"` + Team any `json:"Team,omitempty"` + MyTeam any `json:"MyTeam,omitempty"` + } `json:"data,omitempty"` + Edata any `json:"edata,omitempty"` +} + +func main() { + + url := "https://api.hiloconn.com/v1/h5/activity/ranking?activityId=1028&rankType=4&nonce=0.9194299152147352" + method := "GET" + + client := &http.Client{} + req, err := http.NewRequest(method, url, nil) + + if err != nil { + fmt.Println(err) + return + } + req.Header.Add("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjE3NjMyMTEsIkV4dGVybmFsSWQiOiJkYTllMTJhM2I0ZGU0YWE5Yjc2MjBlNDllYzUyMTliYyIsImV4cCI6MTcyNDU3ODA5MiwiaXNzIjoiaGlsb0FwaSJ9.zzqt1wz20MurMPYL5vvusKB8Fue3QtcHePEP5yQ18-I") + req.Header.Add("nonce", "hilo") + + res, err := client.Do(req) + if err != nil { + fmt.Println(err) + return + } + defer res.Body.Close() + + body, err := ioutil.ReadAll(res.Body) + if err != nil { + fmt.Println(err) + return + } + rsp := new(ActRankData) + if err := json.Unmarshal(body, rsp); err != nil { + panic(err) + } + excelFileName := fmt.Sprintf("./1028-活动榜单.xlsx") + xlFile := xlsx.NewFile() + sheet, err := xlFile.AddSheet("data") + if err != nil { + panic(err) + } + row := sheet.AddRow() + c1, c2, c3, c4 := row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell() + c1.Value, c2.Value, c3.Value, c4.Value = "排名", "User1", "User2", "分数" + for _, d := range rsp.Data.Top3 { + row := sheet.AddRow() + c1, c2, c3, c4 := row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell() + c1.Value, c2.Value, c3.Value, c4.Value = cast.ToString(d.Rank), cast.ToString(d.Code), cast.ToString(d.User2.Code), cast.ToString(d.Score) + } + for _, d := range rsp.Data.List { + row := sheet.AddRow() + c1, c2, c3, c4 := row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell() + c1.Value, c2.Value, c3.Value, c4.Value = cast.ToString(d.Rank), cast.ToString(d.Code), cast.ToString(d.User2.Code), cast.ToString(d.Score) + } + _ = xlFile.Save(excelFileName) +} diff --git a/script/clear_redis.go b/script/clear_redis.go index 7d3f30d17fd2209225f044aa528976530d3ebb20..87ada1c308dfdd6e3b1b87fdcf6bc8ec27d88305 100644 --- a/script/clear_redis.go +++ b/script/clear_redis.go @@ -25,7 +25,7 @@ func main() { }() // 获取所有以"user_qps_"为前缀的键 - keys, err := getKeysWithPrefix(client, "group_in_user_duration_") + keys, err := getKeysWithPrefix(client, "lobby:match:msg:") if err != nil { log.Fatalf("Failed to get keys with prefix: %v", err) } diff --git a/script/fruit_day_detail.go b/script/fruit_day_detail.go new file mode 100644 index 0000000000000000000000000000000000000000..15a1f0b9462b9c7831a661a26e77367ba4b177e2 --- /dev/null +++ b/script/fruit_day_detail.go @@ -0,0 +1,76 @@ +package main + +import ( + "encoding/json" + "fmt" + "github.com/tealeg/xlsx" + "io/ioutil" + "net/http" +) + +type FruitDayDetailResp struct { + Code int `json:"code,omitempty"` + Message string `json:"message,omitempty"` + Data struct { + Total int `json:"total,omitempty"` + Data []struct { + Date string `json:"Date,omitempty"` + Round int `json:"Round,omitempty"` + Pool int `json:"Pool,omitempty"` + UserNum int `json:"UserNum,omitempty"` + Stake int `json:"Stake,omitempty"` + Total int `json:"Total,omitempty"` + AwardNum int `json:"AwardNum,omitempty"` + Award int `json:"Award,omitempty"` + Recycle int `json:"Recycle,omitempty"` + LeftOver int `json:"LeftOver,omitempty"` + FruitId uint64 `json:"FruitId"` + } `json:"data,omitempty"` + } `json:"data,omitempty"` +} + +func ats48(a interface{}) string { + return fmt.Sprintf("%v", a) +} + +func main() { + url := "http://43.135.4.137:8088/v1/fruitMachine/day/detail?lang=zh-cn&pageIndex=1&pageSize=10000&date=2025-11-11" + method := "GET" + + client := &http.Client{} + req, err := http.NewRequest(method, url, nil) + + if err != nil { + fmt.Println(err) + return + } + req.Header.Add("nonce", "hilo") + req.Header.Add("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjEsIkV4dGVybmFsSWQiOiIiLCJleHAiOjE3MTk3NDMzNDd9.O9UCpSAR82xW_w9wKNXOP5jW3lfX5TPYkv8un8Gu1q8") + + res, err := client.Do(req) + if err != nil { + fmt.Println(err) + return + } + defer res.Body.Close() + + body, err := ioutil.ReadAll(res.Body) + if err != nil { + fmt.Println(err) + return + } + var response = new(FruitDayDetailResp) + json.Unmarshal(body, &response) + excelFileName := fmt.Sprintf("./水果机每日明细.xlsx") + xlFile := xlsx.NewFile() + sheet, _ := xlFile.AddSheet("charge") + row := sheet.AddRow() + c1, c2, c3, c4, c5, c6, c7 := row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell() + c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value = "轮次", "开奖位置", "投注", "奖励", "奖池盈余", "系统回收", "本轮盈余" + for _, d := range response.Data.Data { + row := sheet.AddRow() + c1, c2, c3, c4, c5, c6, c7 := row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell() + c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value = ats48(d.Round), ats48(d.FruitId), ats48(d.Stake), ats48(d.Award), ats48(d.Pool), ats48(d.Recycle), ats48(d.LeftOver) + } + _ = xlFile.Save(excelFileName) +} diff --git a/script/fruit_day_stat.go b/script/fruit_day_stat.go index ecda62e2e5ed277b6f84e4c3c9360dc60337d7b8..9cdcb6a3ffabaff09751b3adb8084d7bde760374 100644 --- a/script/fruit_day_stat.go +++ b/script/fruit_day_stat.go @@ -36,7 +36,8 @@ func ats28(a interface{}) string { } func main() { - url := "https://apiv2.faceline.live/v1/fruitMachine/day/stats?lang=zh-cn&pageIndex=1&pageSize=100000&beginDate=2023-04-01&endDate=2023-06-31" + //url := "https://apiv2.faceline.live/v1/fruitMachine/day/stats?lang=zh-cn&pageIndex=1&pageSize=100000&beginDate=2024-04-01&endDate=2024-06-30" + url := "https://apiv2.faceline.live/v1/race/day/stats?lang=zh-cn&pageIndex=1&pageSize=100000&beginDate=2024-04-01&endDate=2024-06-30" method := "GET" client := &http.Client{} @@ -47,7 +48,7 @@ func main() { return } req.Header.Add("nonce", "hilo") - req.Header.Add("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTY5MDYwOTY4NX0.dVsFGjc1wLPxqhAMloXICs-xQcVxM5FkweLvFta3ncA") + req.Header.Add("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTcyMjczNzEzMH0.LZDmjeRkUiYIQA7hVnbb6_xFQtyGf9yev-y6NQqVhRY") res, err := client.Do(req) if err != nil { @@ -63,7 +64,7 @@ func main() { } var response = new(AutoGenerated) json.Unmarshal(body, &response) - excelFileName := fmt.Sprintf("./水果机每日统计.xlsx") + excelFileName := fmt.Sprintf("./赛车每日统计-4-6月.xlsx") xlFile := xlsx.NewFile() sheet, _ := xlFile.AddSheet("charge") row := sheet.AddRow() diff --git a/script/fruit_slot_race_charge_history_sum.go b/script/fruit_slot_race_charge_history_sum.go index 5285524424e7bf6a050d00b55e4604ffa4bb405c..faeb65aea53ad72a558c005cbbd5524f77697c54 100644 --- a/script/fruit_slot_race_charge_history_sum.go +++ b/script/fruit_slot_race_charge_history_sum.go @@ -19,7 +19,7 @@ func ats42(a interface{}) string { return fmt.Sprintf("%v", a) } -var start, end = "2024-05-20 05:00:00", "2024-05-27 05:00:00" // 左闭右开,沙特时间 +var start, end = "2024-05-27 05:00:00", "2024-06-03 05:00:00" // 左闭右开,沙特时间 func main() { @@ -58,7 +58,7 @@ func main() { charges[i].Bet = bets[uc.UserId] } - excelFileName := fmt.Sprintf("./5月20日-5月26日水果机slot赛车数据.xlsx") + excelFileName := fmt.Sprintf("./5月27日-6月02日水果机slot赛车数据.xlsx") xlFile := xlsx.NewFile() sheet, err := xlFile.AddSheet("data") if err != nil { diff --git a/script/promotion_data.go b/script/promotion_data.go index da9aef18a358d2ccbd76eb8dcc42578717bdd4cf..2b5546f44499ec99de6e892118cc1c8d765de6e2 100644 --- a/script/promotion_data.go +++ b/script/promotion_data.go @@ -43,7 +43,7 @@ func main() { pageIndex := 1 pageSize := 1000 for { - url := fmt.Sprintf("https://apiv2.faceline.live/v1/mgr/promotion/invite/data?lang=zh-cn&pageIndex=%d&pageSize=%d&startTime=2023-12-01&endTime=2024-03-31&teamName=&agentCode=&inviteeCode=&platform=All", + url := fmt.Sprintf("https://apiv2.faceline.live/v1/mgr/promotion/invite/data?lang=zh-cn&pageIndex=%d&pageSize=%d&startTime=2024-01-01&endTime=2024-06-30&teamName=&agentCode=&inviteeCode=&platform=All", pageIndex, pageSize) method := "GET" @@ -55,7 +55,7 @@ func main() { return } req.Header.Add("nonce", "hilo") - req.Header.Add("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTcxNDcxNjcyOH0.Mt_gpOenB25vRXDFM4u-oReTNMBYgS7ZvzQumQHOuvU") + req.Header.Add("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTcyMjczNzEzMH0.LZDmjeRkUiYIQA7hVnbb6_xFQtyGf9yev-y6NQqVhRY") res, err := client.Do(req) if err != nil { @@ -80,7 +80,7 @@ func main() { data = append(data, resp.Data.Items...) pageIndex++ } - excelFileName := fmt.Sprintf("./推广员数据12月1日-3月31日.xlsx") + excelFileName := fmt.Sprintf("./推广员数据1月1日-6月30日.xlsx") xlFile := xlsx.NewFile() sheet, err := xlFile.AddSheet("promotion") if err != nil { diff --git a/script/svip_user_charge.go b/script/svip_user_charge.go index 6c56b218e9468158484956adbabc059af163bbdc..38030f0d27461e06d496fc0c4c0d2d14dcaca99c 100644 --- a/script/svip_user_charge.go +++ b/script/svip_user_charge.go @@ -3,9 +3,11 @@ package main import ( "encoding/json" "fmt" + "git.hilo.cn/hilo-common/script/mysql" "github.com/tealeg/xlsx" "io/ioutil" "net/http" + "time" ) type AutoGenerated34 struct { @@ -18,7 +20,7 @@ type AutoGenerated34 struct { } type AutoGenerated34Data struct { - UserID int `json:"userId"` + UserID uint64 `json:"userId"` Date string `json:"date"` Country string `json:"country"` UserCode string `json:"userCode"` @@ -29,6 +31,9 @@ type AutoGenerated34Data struct { SvipLevel int `json:"svipLevel"` MaxDollar int `json:"maxDollar"` // 历史最高单笔 MaxDollarDuration int `json:"maxDollarDuration"` // 时段最高单笔 + Phone string `json:"phone"` + Charm int `json:"charm"` + LastRequestTime string `json:"lastRequestTime"` } func ats34(a interface{}) string { @@ -42,7 +47,7 @@ func main() { pageIndex := 1 pageSize := 1000 for { - url := fmt.Sprintf("https://apiv2.faceline.live/v1/stats/charge/user?lang=zh-cn&diamondType=1&beginDate=2024-03-01&endDate=2024-03-31&pageIndex=%d&pageSize=%d&country=All&code=&area=2&timezone=0", + url := fmt.Sprintf("https://apiv2.faceline.live/v1/stats/charge/user?lang=zh-cn&diamondType=1&beginDate=2020-01-01&endDate=2024-07-05&pageIndex=%d&pageSize=%d&country=All&code=&area=2&timezone=0", pageIndex, pageSize) method := "GET" @@ -54,7 +59,7 @@ func main() { return } req.Header.Add("nonce", "hilo") - req.Header.Add("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTcxNDcxNjcyOH0.Mt_gpOenB25vRXDFM4u-oReTNMBYgS7ZvzQumQHOuvU") + req.Header.Add("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTcyMjczNzEzMH0.LZDmjeRkUiYIQA7hVnbb6_xFQtyGf9yev-y6NQqVhRY") res, err := client.Do(req) if err != nil { @@ -78,17 +83,97 @@ func main() { data = append(data, response.Data.Data...) pageIndex++ } - excelFileName := fmt.Sprintf("./非阿语区黄钻充值20243月.xlsx") + var userIds []uint64 + for _, v := range data { + userIds = append(userIds, v.UserID) + } + phones := GetPhones(userIds) + charms := GetUserCharmLevel(userIds) + requsets := GetRequestLast(userIds) + for i, v := range data { + data[i].Phone = phones[v.UserID] + data[i].Charm = charms[v.UserID] + data[i].LastRequestTime = requsets[v.UserID] + } + excelFileName := fmt.Sprintf("./非阿语区黄钻充值202001-至今.xlsx") xlFile := xlsx.NewFile() sheet, _ := xlFile.AddSheet("charge") row := sheet.AddRow() - c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 := row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell() - c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value, c10.Value = "日期", "国家", "用户ID", "用户昵称", "充值金额", "注册时间", "是否举办首场活动", "svip等级", "时段最高单笔", "历史最高单笔" + c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13 := row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell() + c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value, c10.Value, c11.Value, c12.Value, c13.Value = "日期", "国家", "用户ID", "用户昵称", "充值金额", "注册时间", "是否举办首场活动", "svip等级", "时段最高单笔", "历史最高单笔", "手机号", "魅力等级", "最后登陆时间" for _, d := range data { row := sheet.AddRow() - c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 := row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell() + c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13 := row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell(), row.AddCell() c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value = ats34(d.Date), ats34(d.Country), ats34(d.UserCode), ats34(d.UserName), ats34(d.ChargeMoney), ats34(d.RegisterAt) - c7.Value, c8.Value, c9.Value, c10.Value = ats34(d.HaveFirst), ats34(d.SvipLevel), ats34(d.MaxDollarDuration), ats34(d.MaxDollar) + c7.Value, c8.Value, c9.Value, c10.Value, c11.Value, c12.Value, c13.Value = ats34(d.HaveFirst), ats34(d.SvipLevel), ats34(d.MaxDollarDuration), ats34(d.MaxDollar), d.Phone, ats34(d.Charm), d.LastRequestTime } _ = xlFile.Save(excelFileName) } + +type UserBindInfo struct { + UserId uint64 `gorm:"column:user_id"` + Phone string `gorm:"column:phone"` // 手机号码(包含区号) + AreaCode string `gorm:"column:area_code"` // 国家区号 +} + +func (UserBindInfo) TableName() string { + return "user_bind_info" +} + +func GetPhones(userIds []uint64) map[uint64]string { + var rows []UserBindInfo + if err := mysql.ProdReadOnlyDB.Model(UserBindInfo{}).Where("user_id in ?", userIds).Find(&rows).Error; err != nil { + panic(err) + } + var res = make(map[uint64]string) + for _, v := range rows { + res[v.UserId] = v.AreaCode + v.Phone + } + return res +} + +// MatchCharmUserScore 用户魅力分数 +type MatchCharmUserScore struct { + UserId uint64 `gorm:"column:user_id"` // user_id + Score int64 `gorm:"column:score"` // 分数 + Grade int `gorm:"column:grade"` // 等级 +} + +func (MatchCharmUserScore) TableName() string { + return "match_charm_user_score" +} + +func GetUserCharmLevel(userIds []uint64) map[uint64]int { + var rows []MatchCharmUserScore + if err := mysql.ProdReadOnlyDB.Model(MatchCharmUserScore{}).Where("user_id in ?", userIds).Find(&rows).Error; err != nil { + panic(err) + } + res := make(map[uint64]int) + for _, v := range rows { + res[v.UserId] = v.Grade + } + return res +} + +// UserRequestLast 用户请求最后时间 +type UserRequestLast struct { + ID int64 `gorm:"column:id"` // id + UserId uint64 `gorm:"column:user_id"` // 用户id + TimeLast time.Time `gorm:"column:time_last"` // 最后的时间 +} + +func (UserRequestLast) TableName() string { + return "user_request_last" +} + +func GetRequestLast(userIds []uint64) map[uint64]string { + var rows []UserRequestLast + if err := mysql.ProdReadOnlyDB.Model(UserRequestLast{}).Where("user_id in ?", userIds).Find(&rows).Error; err != nil { + panic(err) + } + res := make(map[uint64]string) + for _, v := range rows { + res[v.UserId] = v.TimeLast.Format("2006-01-02 15:04:05") + } + return res +} diff --git a/script/test_20_in_mic.go b/script/test_20_in_mic.go index ec5f6dd01f1ec15b21cb5505fd70676419a8e262..c9a98a82805cb38972e54e267a22407df73b7cd5 100644 --- a/script/test_20_in_mic.go +++ b/script/test_20_in_mic.go @@ -10,7 +10,7 @@ import ( "time" ) -//var micCodes = []string{"1000653", "1000516", "1000675", "1000890", "1000755", "1000593", "1000629", "1000634", "1000765", "1000591", "1000633", "1000224", "1000611", "1000689", "1000467", "1000384", "1000367", "1000623"} +// var micCodes = []string{"1000653", "1000516", "1000675", "1000890", "1000755", "1000593", "1000629", "1000634", "1000765", "1000591", "1000633", "1000224", "1000611", "1000689", "1000467", "1000384", "1000367", "1000623"} var micCodes = []string{"1110189", "1110188", "1110186", "1110183", "1110180", "1110175", "1110170", "1110160", "1110158", "1110154", "1110152", "1110150", "1110141", "1110139", "1110130", "199777", "1110124", "1110122", "1110120", "1110118"} func main() { @@ -22,7 +22,7 @@ func main() { url := "https://test.apiv1.faceline.live/v1/imGroup/mic/in" method := "POST" - payload := strings.NewReader("groupUuid=HTGS%23a50923362&i=") + payload := strings.NewReader("groupUuid=HTGS_3HIKK4QIV&i=") client := &http.Client{} req, err := http.NewRequest(method, url, payload) diff --git a/script/utils/jwt/jwt.go b/script/utils/jwt/jwt.go index 0f22fd643066d095af2ce9c9e87a428714638491..1f53e02c3b1fd2d9cc814ee90c8606d59bd2ed60 100644 --- a/script/utils/jwt/jwt.go +++ b/script/utils/jwt/jwt.go @@ -12,7 +12,7 @@ type Claims struct { jwt.StandardClaims } -//生成token +// 生成token func GenerateToken(userId uint64, externalId string, issuer string) (string, error) { duration, err := time.ParseDuration("240h") if err != nil { @@ -37,7 +37,7 @@ func GetJWTSecret() []byte { return []byte("hilo1632") } -//解析token +// 解析token func ParseToken(token string) (*Claims, error) { tokenClaims, err := jwt.ParseWithClaims(token, &Claims{}, func(token *jwt.Token) (interface{}, error) { return GetJWTSecret(), nil diff --git a/script/utils/utils_test.go b/script/utils/utils_test.go index 29406551f70fe58d45a27d3c73bdf9fac565a081..6aa049d35e831a1e866b473238104a3a95b98763 100644 --- a/script/utils/utils_test.go +++ b/script/utils/utils_test.go @@ -15,6 +15,6 @@ func TestJwt(t *testing.T) { } func TestJwtParse(t *testing.T) { - c, err := jwt.ParseToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjQyNDAyNjEsIkV4dGVybmFsSWQiOiI0MTIwOWU5NTE0ZDI0ODQwYTliNTMxMDgyMWViNjRkNiIsImV4cCI6MTY5MjI2MTIxNiwiaXNzIjoiaGlsb0FwaSJ9.2ru292Z1q8p87Chzp5DWrR1hMHO3sQcD1X3QNwOio2U") - println(c, err) + c, _ := jwt.ParseToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjg4Nzc2OTEsIkV4dGVybmFsSWQiOiJkNmZlNmJhN2E3ZTI0NjRiYjhhNmU3OTFlNmQxY2E5ZCIsIlRva2VuVmVyc2lvbiI6NywiZXhwIjoxNzE5NTczOTkzLCJpc3MiOiJoaWxvQXBpIn0.EWSFvxzyPDRLWA5eNQ_MSrUDlAeoMhmn0RKw4vfvL6k") + println(c.UserId) }