fix(files): 分销站商品图片按租户范围鉴权

商品图片的绑定校验与历史回退查询统一使用站点归属租户;平台超管保留全量读取,并同步修正审核页超管文案。
This commit is contained in:
2026-11-21 15:55:10 +08:00
parent b4d058ef63
commit 194833ea9b
5 changed files with 164 additions and 9 deletions
+7 -3
View File
@@ -222,15 +222,19 @@ func adminCanAccessFileBinding(ctx context.Context, db *gorm.DB, adminID, tenant
}
switch binding.ResourceType {
case model.FileResourceGameAccount:
if isPlatformSuperAdmin(ctx, db, adminID) {
return true, nil
}
var count int64
if err := db.WithContext(ctx).Table("game_accounts").
Where("id = ? AND source_tenant_id = ?", binding.ResourceID, tenantID).
Count(&count).Error; err != nil || count > 0 {
return count > 0, err
}
err := db.WithContext(ctx).Table("rental_listings").
Where("account_id = ? AND source_tenant_id = ?", binding.ResourceID, tenantID).
Where("distribution_site_id IS NULL OR distribution_site_id = 0").
scopeSQL, scopeArgs := adminListingFileScopeSQL(tenantID, false)
err := db.WithContext(ctx).Table("rental_listings AS l").
Where("l.account_id = ?", binding.ResourceID).
Where(scopeSQL, scopeArgs...).
Count(&count).Error
return count > 0, err
case model.FileResourceChatConversation: