Commit 9efe89fb authored by hujiebin's avatar hujiebin

feat

parent 6372fee0
......@@ -25,7 +25,7 @@ func main() {
}()
// 获取所有以"user_qps_"为前缀的键
keys, err := getKeysWithPrefix(client, "enter_room_")
keys, err := getKeysWithPrefix(client, "group_in_user_duration_")
if err != nil {
log.Fatalf("Failed to get keys with prefix: %v", err)
}
......
......@@ -19,14 +19,17 @@ func ats42(a interface{}) string {
return fmt.Sprintf("%v", a)
}
var start, end = "2024-05-13 05:00:00", "2024-05-20 05:00:00" // 左闭右开,沙特时间
func main() {
var charges []FruitSlotRaceChargeHistoryData
if err := mysql.ProdReadOnlyDB.Raw("select id as user_id,code,SUM(dollar) as dollar,country FROM " +
"(select u.id,u.`code`,SUM(price) / 100 as dollar,u.country FROM pay_order p, `user` u where u.id = p.user_id AND p.`status` = 2 AND `type` = 0 AND p.created_time >= \"2024-04-29\" AND p.created_time < \"2024-05-06\" group by user_id" +
"(select u.id,u.`code`,SUM(price) / 100 as dollar,u.country FROM pay_order p, `user` u where u.id = p.user_id AND p.`status` = 2 AND `type` = 0 AND p.created_time >= \"" + start + "\" AND p.created_time < \"" + end + "\" group by user_id" +
" UNION ALL " +
"select u.id,u.code,SUM(dollar) / 100 as dollar,u.country FROM dealer_transfer_detail d, `user` u where u.id = d.receiver_id AND d.created_time >= \"2024-04-29\" AND d.created_time < \"2024-05-06\" group by receiver_id " +
"select u.id,u.code,SUM(dollar) / 100 as dollar,u.country FROM dealer_transfer_detail d, `user` u where u.id = d.receiver_id AND d.created_time >= \"" + start + "\" AND d.created_time < \"" + end + "\" group by receiver_id " +
" UNION ALL " +
"select u.id,u.code,SUM(dollar) / 100 as dollar,u.country FROM dealer_transfer_detail_pink d, `user` u where u.id = d.receiver_id AND d.created_time >= \"2024-04-29\" AND d.created_time < \"2024-05-06\" group by receiver_id" +
"select u.id,u.code,SUM(dollar) / 100 as dollar,u.country FROM dealer_transfer_detail_pink d, `user` u where u.id = d.receiver_id AND d.created_time >= \"" + start + "\" AND d.created_time < \"" + end + "\" group by receiver_id" +
") t group by code order by dollar DESC").Find(&charges).Error; err != nil {
panic(err)
}
......@@ -55,7 +58,7 @@ func main() {
charges[i].Bet = bets[uc.UserId]
}
excelFileName := fmt.Sprintf("./5月水果机slot赛车数据.xlsx")
excelFileName := fmt.Sprintf("./5月13日-5月19日水果机slot赛车数据.xlsx")
xlFile := xlsx.NewFile()
sheet, err := xlFile.AddSheet("data")
if err != nil {
......@@ -79,7 +82,7 @@ func GetBets(userIds []uint64) map[uint64]uint64 {
}
var bets []Bet
res := make(map[uint64]uint64)
sql := "select user_id,SUM(num) num FROM diamond_account_detail_202405 where operate_type in (69,39,117) AND created_time >= \"2024-05-01\" AND created_time < \"2024-05-06\" and user_id in ? group by user_id"
sql := "select user_id,SUM(num) num FROM diamond_account_detail_202405 where operate_type in (69,39,117) AND created_time >= \"" + start + "\" AND created_time < \"" + end + "\" and user_id in ? group by user_id"
if err := mysql.ProdReadOnlyDB.Raw(sql, userIds).Find(&bets).Error; err != nil {
panic(err)
}
......
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