fix: 区服报表复用批量游戏权限校验
This commit is contained in:
@@ -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] {
|
||||
|
||||
Reference in New Issue
Block a user