|
@@ -156,8 +156,8 @@ public class IdentityAuthService {
|
|
|
|
|
|
|
|
public static void validate(String name, String phone, String idno) {
|
|
public static void validate(String name, String phone, String idno) {
|
|
|
HttpRequest request = HttpRequest.get("https://mobilecert.market.alicloudapi.com/mobile3MetaSimple?userName="
|
|
HttpRequest request = HttpRequest.get("https://mobilecert.market.alicloudapi.com/mobile3MetaSimple?userName="
|
|
|
- + URLEncoder.encode(name, StandardCharsets.UTF_8)
|
|
|
|
|
- + "&identifyNum=" + idno + "&mobile=" + phone)
|
|
|
|
|
|
|
+ + URLEncoder.encode(name, StandardCharsets.UTF_8)
|
|
|
|
|
+ + "&identifyNum=" + idno + "&mobile=" + phone)
|
|
|
.header("Authorization", "APPCODE af29c2d37c4f415fac930d82f01fb559");
|
|
.header("Authorization", "APPCODE af29c2d37c4f415fac930d82f01fb559");
|
|
|
String body = request.body();
|
|
String body = request.body();
|
|
|
if (request.code() != 200) {
|
|
if (request.code() != 200) {
|
|
@@ -260,10 +260,9 @@ public class IdentityAuthService {
|
|
|
User user = userRepo.findById(identityAuth.getUserId()).orElseThrow(new BusinessException("用户不存在"));
|
|
User user = userRepo.findById(identityAuth.getUserId()).orElseThrow(new BusinessException("用户不存在"));
|
|
|
if (user.getAuthStatus() == AuthStatus.SUCCESS) {
|
|
if (user.getAuthStatus() == AuthStatus.SUCCESS) {
|
|
|
result.put("status", AuthStatus.SUCCESS);
|
|
result.put("status", AuthStatus.SUCCESS);
|
|
|
- } else if (!Pattern
|
|
|
|
|
- .matches("[1-9]{1}[0-9]{5}(19|20)[0-9]{2}((0[1-9]{1})|(1[0-2]{1}))((0[1-9]{1})|([1-2]{1}[0-9]{1}|(3[0-1]{1})))[0-9]{3}[0-9x]{1}", identityAuth
|
|
|
|
|
- .getIdNo()
|
|
|
|
|
- .toLowerCase())) {
|
|
|
|
|
|
|
+ } else if (identityAuth.getIdNo() == null ||
|
|
|
|
|
+ !Pattern.matches("[1-9]{1}[0-9]{5}(19|20)[0-9]{2}((0[1-9]{1})|(1[0-2]{1}))((0[1-9]{1})|([1-2]{1}[0-9]{1}|(3[0-1]{1})))[0-9]{3}[0-9x]{1}",
|
|
|
|
|
+ identityAuth.getIdNo().toLowerCase())) {
|
|
|
result.put("status", AuthStatus.FAIL);
|
|
result.put("status", AuthStatus.FAIL);
|
|
|
result.put("reason", "身份证格式错误");
|
|
result.put("reason", "身份证格式错误");
|
|
|
} else {
|
|
} else {
|