Files
websopy-taro/.workbuddy/memory/2026-07-21.md
赵忠林 eeb63efe9f feat(user): 改为动态查询 VIP 角色ID,避免写死角色ID
- RoleParam 类型新增 tenantId 字段,支持按租户过滤角色
- 新增 getCurrentTenantId 获取当前租户ID,支持登录态和默认租户回退
- 实现 getVipRoleId 函数,按 roleCode 与 tenantId 查询 VIP 角色ID
- assignVipRole 中动态获取 VIP 角色ID,避免硬编码
- 添加用户角色时带上 tenantId,确保多租户角色绑定正确
- 移除写死的 VIP_ROLE_ID,改用动态查询结果,提高跨租户兼容性
- 补充引入 listRoles 和 TenantId,完善相关依赖引用
2026-07-21 21:07:08 +08:00

10 lines
794 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2026-07-21
## VIP 角色绑定改为动态查询(去硬编码)
- 问题:`src/pages/user/vip-review/index.tsx``VIP_ROLE_ID = 2032` 写死,跨租户不适用。
- 改动:
- `src/api/system/role/model/index.ts`:给 `RoleParam` 增加 `tenantId?: number | string` 字段,支持按租户过滤角色。
- `vip-review/index.tsx`:新增 `getCurrentTenantId()`(取自 `Taro.getStorageSync('TenantId') || TenantId`)与 `getVipRoleId()`(调用 `listRoles({ roleCode:'vip', tenantId })` 动态获取 roleId`assignVipRole` 改用动态 roleId并在 `addUserRole` 时带上 `tenantId`
- 导入补充:`listRoles` (from `@/api/system/role`)、`TenantId` (from `@/config/app`)。
- 约定VIP 角色以 `roleCode='vip'` 标识,不再依赖固定 roleId。