fix(withdrawal): 恢复分销站点用户提现审核可见性
This commit is contained in:
@@ -17,9 +17,9 @@ import (
|
|||||||
// 管理员查询提现列表
|
// 管理员查询提现列表
|
||||||
func (r *Repository) AdminList(ctx context.Context, query AdminListQuery) (*AdminPaginatedResult, error) {
|
func (r *Repository) AdminList(ctx context.Context, query AdminListQuery) (*AdminPaginatedResult, error) {
|
||||||
db := r.db.WithContext(ctx).Model(&model.WithdrawalRequest{})
|
db := r.db.WithContext(ctx).Model(&model.WithdrawalRequest{})
|
||||||
|
// distribution_site_id 只表示获客渠道,不能把同租户内分销站点用户的提现挡在财务审核列表外。
|
||||||
if tenantID := tenancy.IDFromContext(ctx); tenantID > 0 {
|
if tenantID := tenancy.IDFromContext(ctx); tenantID > 0 {
|
||||||
db = db.Where("tenant_id = ?", tenantID).
|
db = db.Where("tenant_id = ?", tenantID)
|
||||||
Where("distribution_site_id = 0")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if query.Status != "" {
|
if query.Status != "" {
|
||||||
|
|||||||
@@ -421,6 +421,13 @@ func TestWithdrawalRequestsAreScopedByTenant(t *testing.T) {
|
|||||||
if err := db.Create(&jieyouUser).Error; err != nil {
|
if err := db.Create(&jieyouUser).Error; err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
site := model.DistributionSite{
|
||||||
|
SiteCode: "tianyu_test", SiteName: "天域商行",
|
||||||
|
Domain: "tianyu.example.com", Status: "active",
|
||||||
|
}
|
||||||
|
if err := db.Create(&site).Error; err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
dachuiAccount := model.UserPaymentAccount{
|
dachuiAccount := model.UserPaymentAccount{
|
||||||
TenantID: 101, UserID: dachuiUser.ID, AccountType: "bank",
|
TenantID: 101, UserID: dachuiUser.ID, AccountType: "bank",
|
||||||
AccountName: "张三", AccountNo: "encrypted", Status: "active",
|
AccountName: "张三", AccountNo: "encrypted", Status: "active",
|
||||||
@@ -454,6 +461,21 @@ func TestWithdrawalRequestsAreScopedByTenant(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("create dachui withdrawal: %v", err)
|
t.Fatalf("create dachui withdrawal: %v", err)
|
||||||
}
|
}
|
||||||
|
siteWithdrawal := model.WithdrawalRequest{
|
||||||
|
WithdrawNo: "WD-TENANT-SITE",
|
||||||
|
TenantID: 101,
|
||||||
|
UserID: dachuiUser.ID,
|
||||||
|
DistributionSiteID: site.ID,
|
||||||
|
AmountCent: 1500,
|
||||||
|
ActualAmountCent: 1500,
|
||||||
|
AccountType: "bank",
|
||||||
|
AccountName: "张三",
|
||||||
|
AccountNo: "****0000",
|
||||||
|
Status: "pending",
|
||||||
|
}
|
||||||
|
if err := db.Create(&siteWithdrawal).Error; err != nil {
|
||||||
|
t.Fatalf("create distribution site withdrawal: %v", err)
|
||||||
|
}
|
||||||
if _, err := repo.Create(jieyouCtx, jieyouUser.ID, CreateWithdrawalRequest{
|
if _, err := repo.Create(jieyouCtx, jieyouUser.ID, CreateWithdrawalRequest{
|
||||||
PaymentAccountID: jieyouAccount.ID,
|
PaymentAccountID: jieyouAccount.ID,
|
||||||
AmountCent: 2000,
|
AmountCent: 2000,
|
||||||
@@ -471,6 +493,25 @@ func TestWithdrawalRequestsAreScopedByTenant(t *testing.T) {
|
|||||||
if _, err := repo.FindByID(jieyouCtx, dachuiUser.ID, dachuiWithdrawal.ID); !errors.Is(err, ErrWithdrawalNotFound) {
|
if _, err := repo.FindByID(jieyouCtx, dachuiUser.ID, dachuiWithdrawal.ID); !errors.Is(err, ErrWithdrawalNotFound) {
|
||||||
t.Fatalf("cross-tenant withdrawal lookup error = %v", err)
|
t.Fatalf("cross-tenant withdrawal lookup error = %v", err)
|
||||||
}
|
}
|
||||||
|
dachuiList, err := repo.AdminList(dachuiCtx, AdminListQuery{Page: 1, Size: 20})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("dachui withdrawal list: %v", err)
|
||||||
|
}
|
||||||
|
if dachuiList.Total != 2 || len(dachuiList.Items) != 2 {
|
||||||
|
t.Fatalf("dachui withdrawal list = %+v, want 2 withdrawals", dachuiList)
|
||||||
|
}
|
||||||
|
foundSiteWithdrawal := false
|
||||||
|
for _, item := range dachuiList.Items {
|
||||||
|
if item.ID == siteWithdrawal.ID {
|
||||||
|
foundSiteWithdrawal = true
|
||||||
|
if item.DistributionSiteID != site.ID || item.DistributionSiteName != site.SiteName {
|
||||||
|
t.Fatalf("distribution site withdrawal item = %+v", item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !foundSiteWithdrawal {
|
||||||
|
t.Fatal("dachui admin list hides distribution site withdrawal")
|
||||||
|
}
|
||||||
list, err := repo.AdminList(jieyouCtx, AdminListQuery{Page: 1, Size: 20})
|
list, err := repo.AdminList(jieyouCtx, AdminListQuery{Page: 1, Size: 20})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ A 站商品进入 B 站货架
|
|||||||
- 每个站点只能管理本站发起的线下提号;提号时可以选择另一站点的已上架货源。
|
- 每个站点只能管理本站发起的线下提号;提号时可以选择另一站点的已上架货源。
|
||||||
- 跨站线下提号的利润和出款统计归属提号站点,号主结算进入货源站点号主钱包。
|
- 跨站线下提号的利润和出款统计归属提号站点,号主结算进入货源站点号主钱包。
|
||||||
- 两个站点的手动录单、平台选项、操作人选项和出款操作人选项互不可见。
|
- 两个站点的手动录单、平台选项、操作人选项和出款操作人选项互不可见。
|
||||||
- 历史分销用户、订单、钱包和提现不会进入经营站点后台及统计。
|
- 历史分销用户、订单、钱包和分销结算不会进入经营站点后台及统计;历史分销用户钱包提现仍按所属经营租户进入提现审核列表,由主站财务审核,但不计入经营站点财务统计。
|
||||||
- 每个经营站点可以在商品详情中独立设置本站售价和展示状态。
|
- 每个经营站点可以在商品详情中独立设置本站售价和展示状态。
|
||||||
- 无租户上下文的任务暂停并告警。
|
- 无租户上下文的任务暂停并告警。
|
||||||
- 现有分销 E2E 全部通过。
|
- 现有分销 E2E 全部通过。
|
||||||
|
|||||||
Reference in New Issue
Block a user