perf: 减少统计页面资料读取并优化区服选项查询

This commit is contained in:
Yvan
2026-11-04 16:42:11 +08:00
parent 503f3b1a7d
commit 2efce4d821
8 changed files with 184 additions and 13 deletions
+12
View File
@@ -34,6 +34,9 @@ func TestAnalyticsChannelTreeAndAdminOfficialRows(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if err := repo.FillNames(context.Background(), business.ChannelAnalytics, scope, filter, data.Rows); err != nil {
t.Fatal(err)
}
if len(data.Rows) != 3 || data.GlobalCounts != nil {
t.Fatalf("普通商务统计范围错误: %+v", data)
}
@@ -69,6 +72,12 @@ func TestAnalyticsFiltersKeepHierarchyAndSnapshotNames(t *testing.T) {
kind := 1
filter.PromoteType = &kind
data, err = repo.Aggregate(context.Background(), business.ChannelAnalytics, scope, filter)
if err != nil {
t.Fatal(err)
}
if err := repo.FillNames(context.Background(), business.ChannelAnalytics, scope, filter, data.Rows); err != nil {
t.Fatal(err)
}
if err != nil || len(data.Rows) != 1 || data.Rows[0].ID != 100 || portraitTestMoney(data.Rows[0].Pay) != "20.20" || data.Rows[0].PromoteType == nil || *data.Rows[0].PromoteType != 0 {
t.Fatalf("类型筛选应限制参与渠道,同时显示归根后的当前资料: %+v %v", data, err)
}
@@ -78,6 +87,9 @@ func TestAnalyticsFiltersKeepHierarchyAndSnapshotNames(t *testing.T) {
if err != nil || len(data.Rows) != 2 {
t.Fatalf("按游戏快照名筛选错误: %+v %v", data, err)
}
if err := repo.FillNames(context.Background(), business.GameAnalytics, scope, filter, data.Rows); err != nil {
t.Fatal(err)
}
for _, row := range data.Rows {
if row.SourceDB == "lx" && (row.ID != 1 || row.Name != "游戏甲" || row.Counts.Register != 1) {
t.Fatalf("应按报表快照筛选、用当前游戏名展示: %+v", row)