|
|
@@ -830,7 +830,22 @@ public class StorePlatformUserRoleServiceImpl extends ServiceImpl<StorePlatformU
|
|
|
LambdaUpdateWrapper<StorePlatformUserRole> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.eq(StorePlatformUserRole::getId, id)
|
|
|
.eq(StorePlatformUserRole::getDeleteFlag, 0) // 只更新未删除的记录
|
|
|
- .set(StorePlatformUserRole::getStatus, status); // 根据传入的 status 值更新
|
|
|
+ .set(StorePlatformUserRole::getStatus, status);
|
|
|
+ // 根据传入的 status 值更新
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(userRole.getUserId());
|
|
|
+ if (storeUser != null && storeUser.getPhone() != null) {
|
|
|
+ // 删除Redis中的token,key格式:storePlatform_手机号
|
|
|
+ String tokenKey = "store_" + storeUser.getPhone();
|
|
|
+ String existingToken = baseRedisService.getString(tokenKey);
|
|
|
+ if (existingToken != null) {
|
|
|
+ baseRedisService.delete(tokenKey);
|
|
|
+ log.info("清除角色编辑后的用户token成功 userId={}, phone={}, tokenKey={}",
|
|
|
+ userRole.getUserId(), storeUser.getPhone(), tokenKey);
|
|
|
+ } else {
|
|
|
+ log.warn("用户token不存在或已过期,userId={}, phone={}, tokenKey={}",
|
|
|
+ userRole.getUserId(), storeUser.getPhone(), tokenKey);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
int updateResult = storePlatformUserRoleMapper.update(null, updateWrapper);
|
|
|
if (updateResult > 0) {
|