feat(withdrawal): 开放售后提现审核权限

This commit is contained in:
yml
2026-11-26 22:15:40 +08:00
parent abbb977ca6
commit 128301f47a
6 changed files with 57 additions and 12 deletions
@@ -560,6 +560,22 @@ func TestWithdrawalAdminAllTenantScopeIncludesLegacyDistribution(t *testing.T) {
t.Fatalf("dachui admin legacy detail error = %v, want not found", err)
}
dachuiFinanceCtx := tenancy.WithScope(context.Background(), tenancy.Scope{
TenantID: 101, TenantCode: "dachui",
})
legacyList, err := repo.AdminList(dachuiFinanceCtx, AdminListQuery{Page: 1, Size: 20})
if err != nil {
t.Fatal(err)
}
if legacyList.Total != 2 || len(legacyList.Items) != 2 {
t.Fatalf("dachui withdrawal list with legacy records = %+v, want 2", legacyList)
}
if detail, err := repo.AdminFindByID(dachuiFinanceCtx, withdrawals[0].ID); err != nil {
t.Fatalf("dachui legacy detail: %v", err)
} else if detail.DistributionSiteID != site.ID {
t.Fatalf("dachui legacy detail site = %d, want %d", detail.DistributionSiteID, site.ID)
}
superCtx := tenancy.WithAdminAllTenantScope(dachuiCtx)
superList, err := repo.AdminList(superCtx, AdminListQuery{Page: 1, Size: 20})
if err != nil {
@@ -576,7 +592,7 @@ func TestWithdrawalAdminAllTenantScopeIncludesLegacyDistribution(t *testing.T) {
t.Fatalf("legacy withdrawal detail = %+v", detail)
}
approved := true
reviewed, err := repo.Review(superCtx, 1, withdrawals[0].ID, ReviewWithdrawalRequest{Approved: &approved})
reviewed, err := repo.Review(dachuiFinanceCtx, 1, withdrawals[0].ID, ReviewWithdrawalRequest{Approved: &approved})
if err != nil {
t.Fatalf("platform super admin legacy review: %v", err)
}