Files
websopy-taro/.workbuddy/memory/2026-07-22.md
赵忠林 12d6bdfb06 feat(user): 动态查询VIP角色ID,避免硬编码绑定问题
- RoleParam新增tenantId字段,支持按租户过滤角色
- 新增getCurrentTenantId函数,兼容登录态及默认租户回退
- 实现getVipRoleId函数,按roleCode与tenantId查询VIP角色ID
- assignVipRole动态获取VIP角色ID,移除写死的角色ID
- 添加用户角色时传入tenantId,确保多租户环境中角色绑定正确
- 修复后端UserRoleController.save接口bug,避免userId被无条件覆盖
- 用户角色绑定时正确使用申请人userId,解决VIP审核角色误绑定问题
2026-07-22 01:04:23 +08:00

9 lines
779 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-22
## 修复 UserRoleController.save 覆盖 userId 的 bug
- 文件:`com.gxwebsoft.core/.../system/controller/UserRoleController.java`
- 问题:原 `save``getLoginUser().getUserId()` **无条件覆盖**请求体 userId导致 VIP 审核通过时角色绑到店员而非申请人。
- 修复:改为 `if (userRole.getUserId() == null && loginUser != null) userRole.setUserId(loginUser.getUserId());`(仅当请求体未传 userId 时回退到登录用户)。
- 影响VIP 审核 `addUserRole({ userId: item.userId, ... })` 现在能正确把角色绑给申请人;其它不传 userId 的调用方行为不变。
- 注意UserRole 的 `tenantId` 由 MyBatis-Plus 多租户插件按请求头自动写入 INSERT前端传的 tenantId 仅作冗余。