fix: 区服报表复用批量游戏权限校验

This commit is contained in:
Yvan
2026-11-05 09:26:16 +08:00
parent 26a8030e8d
commit ee20692e95
3 changed files with 39 additions and 13 deletions
+3 -12
View File
@@ -291,18 +291,9 @@ func filterAnalyticsGames(db *gorm.DB, scope business.AnalyticsScope, f business
for key := range rows {
keys = append(keys, key)
}
allowed := map[business.AnalyticsKey]bool{}
for start := 0; start < len(keys); start += 300 {
var games []analyticsAggPO
q := approvedGamesQuery(db, scope.Viewer, f.Sources).Where("(g.source_db,g.id) IN ?", analyticsPairs(keys[start:min(start+300, len(keys))]))
if err := q.Select("g.source_db,g.id AS entity_id").Scan(&games).Error; err != nil {
return business.ErrStorage
}
for _, game := range games {
if game.ID != nil {
allowed[business.AnalyticsKey{SourceDB: game.SourceDB, ID: *game.ID}] = true
}
}
allowed, err := approvedGameKeys(db, scope.Viewer, f.Sources, keys)
if err != nil {
return err
}
for key := range rows {
if !allowed[key] {