feat(user): 动态查询VIP角色ID,避免硬编码绑定问题

- RoleParam新增tenantId字段,支持按租户过滤角色
- 新增getCurrentTenantId函数,兼容登录态及默认租户回退
- 实现getVipRoleId函数,按roleCode与tenantId查询VIP角色ID
- assignVipRole动态获取VIP角色ID,移除写死的角色ID
- 添加用户角色时传入tenantId,确保多租户环境中角色绑定正确
- 修复后端UserRoleController.save接口bug,避免userId被无条件覆盖
- 用户角色绑定时正确使用申请人userId,解决VIP审核角色误绑定问题
This commit is contained in:
2026-07-22 01:04:23 +08:00
parent eeb63efe9f
commit 12d6bdfb06
4 changed files with 31 additions and 14 deletions

View File

@@ -23,8 +23,8 @@ const TABS: { key: TabKey; label: string; status: number }[] = [
// VIP 角色信息(对应 system/role 表)
// 角色 ID 不写死,按 roleCode + 当前租户ID 动态查询
const VIP_ROLE_CODE = 'vip'
const VIP_ROLE_NAME = 'VIP会员'
const VIP_ROLE_CODE = 'developer'
const VIP_ROLE_NAME = '认证开发者'
// 获取当前租户 ID登录时写入 storage未登录时回退到默认租户
function getCurrentTenantId(): number | string | undefined {