|
|
@@ -25,6 +25,9 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
|
|
|
@Value("${smsVerify.apikey}")
|
|
|
String apiKey;
|
|
|
|
|
|
+ @Value("${smsVerify.shoppingApikey}")
|
|
|
+ String shoppingApikey;
|
|
|
+
|
|
|
private final RedisService redisService;
|
|
|
|
|
|
private static final int PHONE_CODE_GET_NUM_DAY_LIMIT = 30;
|
|
|
@@ -41,15 +44,16 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
|
|
|
}
|
|
|
if (StringUtils.isBlank(verifyCode)) {
|
|
|
throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
- }else {
|
|
|
- Map<String, Object> parmas = new HashMap<>();
|
|
|
- parmas.put("api_key", apiKey);
|
|
|
- parmas.put("response", verifyCode);
|
|
|
- String post = HttpUtil.post(VERIFY_URL, parmas);
|
|
|
- JSONObject res = new JSONObject(post);
|
|
|
+ } else {
|
|
|
+ //银河官网
|
|
|
+ JSONObject res = checkVerifyCode(apiKey, verifyCode);
|
|
|
if (!res.getStr("res").equals("success")) {
|
|
|
- log.error("手机号:{}验证码校验不通过 res:{}", phone, res);
|
|
|
- throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
+ //小店域名
|
|
|
+ res = checkVerifyCode(shoppingApikey, verifyCode);
|
|
|
+ if (!res.getStr("res").equals("success")) {
|
|
|
+ log.error("手机号:{}验证码校验不通过 res:{}", phone, res);
|
|
|
+ throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
String dayKey = RedisService.key.PHONE_CODE_USER_NUM_KEY_DAY.getName() + phone;
|
|
|
@@ -95,4 +99,13 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
|
|
|
redisService.setNx(RetryTimeKey, 1, RedisService.key.PHONE_CODE_RETRY_TIME_KEY.getTimeout());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public JSONObject checkVerifyCode(String apiKey, String verifyCode) {
|
|
|
+ Map<String, Object> parmas = new HashMap<>();
|
|
|
+ parmas.put("api_key", apiKey);
|
|
|
+ parmas.put("response", verifyCode);
|
|
|
+ String post = HttpUtil.post(VERIFY_URL, parmas);
|
|
|
+ JSONObject res = new JSONObject(post);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|