diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/service/impl/UserServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/service/impl/UserServiceImpl.java index 44fb9e54..6e4686e7 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/service/impl/UserServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/service/impl/UserServiceImpl.java @@ -1083,7 +1083,7 @@ public class UserServiceImpl extends ServiceImpl implements } private LoginResponseVO phoneLoginByVerifiedPhone(String phone, Long shopId, boolean rememberMe) { - String normalizedPhone = validateUserPhone(phone, null, true); + String normalizedPhone = normalizeVerifiedPhone(phone); UserDO userDO = userMapper.selectOne( Wrappers.lambdaQuery(UserDO.class) @@ -1104,6 +1104,14 @@ public class UserServiceImpl extends ServiceImpl implements return buildLoginResponse(userDO, resolvedShopId, ENCODED_UNSET_PASSWORD.equals(userDO.getPassword()), rememberMe); } + private String normalizeVerifiedPhone(String phone) { + String normalizedPhone = phone == null ? null : phone.trim(); + if (!StringUtils.hasText(normalizedPhone) || !normalizedPhone.matches(PHONE_REGEX)) { + throw new RuntimeException("手机号格式不正确"); + } + return normalizedPhone; + } + private LoginResponseVO buildRegistrationRequiredResponse(String phone, UserDO userDO, String reason) { WorkbenchRegistrationApplicationDO application = userDO == null ? null : registrationApplicationMapper.selectOne( Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class)