feat: 按原型更新商务明细与游戏分析并清理临时资料

This commit is contained in:
Yvan
2026-11-04 18:13:03 +08:00
parent 19926d275c
commit f866cac768
41 changed files with 392 additions and 2955 deletions
+13
View File
@@ -79,6 +79,9 @@ type analyticsAggPO struct {
func analyticsRoot(db *gorm.DB, kind business.AnalyticsKind, scope business.AnalyticsScope, f business.AnalyticsFilter, table string, mode int, pay bool) (*gorm.DB, string) {
q := analyticsQuery(db, scope, f, table, mode)
if kind == business.GameAnalytics {
q = q.Where("(r.source_db,r.game_id) IN (?)", approvedGamesQuery(db, scope.Viewer, f.Sources).Select("g.source_db,g.id"))
}
id := "r.game_id"
if kind == business.ChannelAnalytics {
id = "r.promote_id"
@@ -124,6 +127,16 @@ func (r *analyticsRepo) Aggregate(ctx context.Context, kind business.AnalyticsKi
if empty || !available {
return result, nil
}
if kind == business.GameAnalytics {
available, err := approvedGamesAvailable(db)
if err != nil {
return nil, err
}
if !available {
result.Available = false
return result, nil
}
}
for _, table := range []string{"tab_sw_report_day", "tab_sw_report_day_key"} {
available, err := businessTableAvailable(db, table)
if err != nil {