diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java index 7f26b1a..f500249 100644 --- a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java @@ -89,6 +89,7 @@ public class BsUserServiceImpl implements BsUserService { if (user == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户"); } + String oldPhone = user.getPhone(); user.setPhone(newPhone); editData(user); @@ -97,6 +98,8 @@ public class BsUserServiceImpl implements BsUserService { session.setUser(user); SessionObject sessionObject = new SessionObject(userToken(user.getId()), session); userCenter.save(sessionObject); + // 删除缓存 + redisUtil.hdel(CACHE_KEY, oldPhone); } @Override