手机号校验码-checkPhoneFormat-先校验手机区号是否是手机号前缀

This commit is contained in:
khalil
2025-06-04 18:19:53 +08:00
parent 78c9e0fdb2
commit bb8bf35f6b

View File

@@ -265,8 +265,11 @@ public class CommonUtil {
}
String realPhone = phone;
if (realPhone.startsWith(areaCode)) {
realPhone = realPhone.replaceFirst(areaCode, "");
return false;
}
realPhone = realPhone.replaceFirst(areaCode, "");
// 优先以配置的正则校验
if (!CollectionUtils.isEmpty(SystemConfig.phoneRegex)) {
String phoneRegex = SystemConfig.phoneRegex.get(areaCode);