优化手机验证码注册 user_id异常的问题
This commit is contained in:
@@ -56,8 +56,10 @@ public class UserService implements UserDetailsService {
|
||||
// 2. 检查手机号是否已注册
|
||||
if (userRepository.existsByPhone(phone)) {
|
||||
User user = userRepository.findByPhone(phone).get();
|
||||
user.setUserId(deviceId);
|
||||
user.setNewUser(false);
|
||||
user.setDeviceId(deviceId);
|
||||
user.setLastLoginTime(createTime);
|
||||
user.setUpdateTime(createTime);
|
||||
return user;
|
||||
} else {
|
||||
// 3. 创建新用户
|
||||
@@ -116,4 +118,11 @@ public class UserService implements UserDetailsService {
|
||||
return userRepository.findUserByUserId(userId).
|
||||
orElseThrow(() -> new UsernameNotFoundException("User not found with userId: " + userId));
|
||||
}
|
||||
|
||||
// public boolean updateUser(User user) {
|
||||
// if (!userRepository.existsByUserId(user.getUserId())) {
|
||||
// return false;
|
||||
// }
|
||||
// return userRepository.updateUser(user);
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user