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
+29 -7
View File
@@ -40,7 +40,7 @@ func TestRegistrationScopePuidAndUnboundedPlayerPay(t *testing.T) {
first = row
}
}
if first == nil || first.TotalPayAmount == nil || portraitTestMoney(*first.TotalPayAmount) != "710.10" || first.FirstGameName != "历史游戏名" || first.DisplayBusiness() != "lx-business(leaf)" {
if first == nil || first.TotalPayAmount == nil || portraitTestMoney(*first.TotalPayAmount) != "710.10" || first.FirstGameName != "历史游戏名" || first.DisplayBusiness() != "parent→branch→leaf" {
t.Fatalf("累计充值不能受本次时间/渠道限制,且需保留游戏快照: %+v", first)
}
filter.SortField = "totalPayAmount"
@@ -59,19 +59,19 @@ func TestRegistrationScopePuidAndUnboundedPlayerPay(t *testing.T) {
if err != nil || page.Total != 2 {
t.Fatal("精确子渠道账号应扩到同一一级树内的可见渠道")
}
filter.PromoteAccount = "CHILD-channel"
filter.PromoteAccount = "CHILD-chan"
page, err = repo.Registrations(ctx, scope, filter, business.LedgerListOptions{Limit: 20})
if err != nil || page.Total != 0 {
t.Fatal("渠道账号应保持区分大小写的精确匹配")
if err != nil || page.Total != 2 {
t.Fatal("渠道应支持不区分大小写的模糊匹配")
}
}
func TestSpendSummaryIgnoresSelectedFailureStatusAndKeepsSnapshot(t *testing.T) {
func TestSpendSummaryRespectsSelectedStatusAndKeepsSnapshot(t *testing.T) {
_, repo, scope, filter := prepareLedgerData(t)
status := 0
filter.PayStatus = &status
page, err := repo.Spends(context.Background(), scope, filter, business.LedgerListOptions{Limit: 20})
if err != nil || page.Total != 1 || page.Rows[0].ID != 904 || portraitTestMoney(*page.TotalPayAmount) != "80.80" {
t.Fatalf("失败列表与成功支付合计不能使用同一个状态条件: %+v %v", page, err)
if err != nil || page.Total != 1 || page.Rows[0].ID != 904 || portraitTestMoney(*page.TotalPayAmount) != "0.00" {
t.Fatalf("失败状态筛选下不能汇总筛选外成功订单: %+v %v", page, err)
}
status = 2
page, err = repo.Spends(context.Background(), scope, filter, business.LedgerListOptions{Limit: 20})
@@ -125,3 +125,25 @@ func TestLedgerLargeTreeFilterDoesNotFallBackToAll(t *testing.T) {
t.Fatal("缺渠道范围表不能把限制解释为全量")
}
}
func TestLedgerChannelNicknameAndLiteralFuzzyFilter(t *testing.T) {
db, repo, scope, filter := prepareLedgerData(t)
if err := db.Exec("UPDATE tab_promote SET nickname='推广公会' WHERE source_db='lx' AND id=100").Error; err != nil {
t.Fatal(err)
}
filter.PromoteAccount = "公会"
page, err := repo.Spends(context.Background(), scope, filter, business.LedgerListOptions{Limit: 20})
if err != nil || page.Total != 4 {
t.Fatalf("昵称片段应命中渠道及可见下级: %+v %v", page, err)
}
filter.PromoteAccount = "%"
page, err = repo.Spends(context.Background(), scope, filter, business.LedgerListOptions{Limit: 20})
if err != nil || page.Total != 0 {
t.Fatal("模糊输入中的百分号应按文字匹配")
}
filter.PromoteAccount = "other"
page, err = repo.Spends(context.Background(), scope, filter, business.LedgerListOptions{Limit: 20})
if err != nil || page.Total != 0 {
t.Fatal("模糊搜索不得扩大商务范围")
}
}