fix(withdrawal): 允许平台超管审核历史分销提现

This commit is contained in:
yml
2026-11-26 22:01:59 +08:00
parent 18b54e9f1a
commit abbb977ca6
5 changed files with 82 additions and 33 deletions
@@ -7,7 +7,6 @@ import (
"strings"
"hfb_sys/backend/internal/model"
"hfb_sys/backend/internal/tenancy"
)
// 转换为用户DTO
@@ -60,9 +59,7 @@ func (r *Repository) toAdminListItems(ctx context.Context, withdrawals []model.W
usersByID := make(map[uint64]model.User, len(userIDs))
var users []model.User
userQuery := r.db.WithContext(ctx).Select("id, nickname, phone").Where("id IN ?", userIDs)
if tenantID := tenancy.IDFromContext(ctx); tenantID > 0 {
userQuery = userQuery.Where("tenant_id = ?", tenantID)
}
userQuery = scopeAdminTenant(ctx, userQuery, "tenant_id")
if err := userQuery.Find(&users).Error; err != nil {
return nil, err
}
@@ -111,13 +108,10 @@ func (r *Repository) toAdminListItems(ctx context.Context, withdrawals []model.W
// 转换为管理员详细DTO
func (r *Repository) toDetailDTO(ctx context.Context, w model.WithdrawalRequest) (*WithdrawalDetailDTO, error) {
db := r.db.WithContext(ctx)
tenantID := tenancy.IDFromContext(ctx)
// 查询用户信息
var user model.User
userQuery := db.Select("nickname, phone").Where("id = ?", w.UserID)
if tenantID > 0 {
userQuery = userQuery.Where("tenant_id = ?", tenantID)
}
userQuery = scopeAdminTenant(ctx, userQuery, "tenant_id")
userQuery.First(&user)
// 查询审核人信息
@@ -144,9 +138,7 @@ func (r *Repository) toDetailDTO(ctx context.Context, w model.WithdrawalRequest)
if w.PaymentAccountID != nil {
var paymentAccount model.UserPaymentAccount
accountQuery := db.Where("id = ?", *w.PaymentAccountID)
if tenantID > 0 {
accountQuery = accountQuery.Where("tenant_id = ?", tenantID)
}
accountQuery = scopeAdminTenant(ctx, accountQuery, "tenant_id")
if err := accountQuery.First(&paymentAccount).Error; err == nil {
// 解密账号
decrypted, err := r.encryptor.Decrypt(paymentAccount.AccountNo)