2026-01-27 01:33:32 +08:00

43 lines
933 B
Go

package main
import (
"bindbox-game/configs"
"bindbox-game/internal/repository/mysql"
"bindbox-game/internal/repository/mysql/model"
"flag"
"fmt"
"time"
)
func main() {
flag.Parse()
configs.Init()
dbRepo, err := mysql.New()
if err != nil {
panic(err)
}
db := dbRepo.GetDbR()
startTime, _ := time.ParseInLocation("2006-01-02", "2026-01-19", time.Local)
endTime := startTime.Add(24 * time.Hour)
var logs []model.LivestreamDrawLogs
db.Where("created_at >= ? AND created_at < ?", startTime, endTime).Find(&logs)
fmt.Printf("Found %d Livestream Draw Logs on Jan 19th.\n", len(logs))
activityCounts := make(map[int64]int)
for _, l := range logs {
activityCounts[l.ActivityID]++
}
for id, count := range activityCounts {
fmt.Printf("Livestream Activity ID: %d, Count: %d\n", id, count)
// Get Name
var act model.LivestreamActivities
db.First(&act, id)
fmt.Printf(" -> Name: %s\n", act.Name)
}
}