|
|
@@ -37,6 +37,19 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
|
|
|
if ("13662979985".equals(phone)) {
|
|
|
throw BusinessRuntimeException.getInstance("异常手机号");
|
|
|
}
|
|
|
+ if (StringUtils.isBlank(verifyCode)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
+ }else {
|
|
|
+ JSONObject parmas = new JSONObject();
|
|
|
+ parmas.putOpt("api_key", apiKey);
|
|
|
+ parmas.putOpt("response", verifyCode);
|
|
|
+ String post = HttpUtil.post(VERIFY_URL, parmas.toString());
|
|
|
+ JSONObject res = new JSONObject(post);
|
|
|
+ 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;
|
|
|
if (redisService.hasKey(RedisService.key.PHONE_CODE_BALCK_KEY.getName() + phone)) {
|
|
|
throw BusinessRuntimeException.getInstance("异常手机号");
|
|
|
@@ -52,19 +65,6 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
|
|
|
log.error("手机号:{}频繁获取短信验证码", phone);
|
|
|
throw BusinessRuntimeException.getInstance("请勿频繁获取短信验证码");
|
|
|
}
|
|
|
- if (StringUtils.isBlank(verifyCode)) {
|
|
|
- throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
- }else {
|
|
|
- JSONObject parmas = new JSONObject();
|
|
|
- parmas.putOpt("api_key", apiKey);
|
|
|
- parmas.putOpt("response", verifyCode);
|
|
|
- String post = HttpUtil.post(VERIFY_URL, parmas.toString());
|
|
|
- JSONObject res = new JSONObject(post);
|
|
|
- if (!res.getStr("res").equals("success")) {
|
|
|
- log.error("手机号:{}验证码校验不通过 res:{}", phone, res);
|
|
|
- throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
- }
|
|
|
- }
|
|
|
return;
|
|
|
}
|
|
|
redisService.set(dayKey, 1, RedisService.key.PHONE_CODE_USER_NUM_KEY_DAY.getTimeout());
|