|
@@ -1,15 +1,16 @@
|
|
|
package com.cyksj.service.user.impl;
|
|
package com.cyksj.service.user.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.extra.servlet.ServletUtil;
|
|
import cn.hutool.extra.servlet.ServletUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
|
|
+import com.cyksj.common.util.SmsUtil;
|
|
|
import com.cyksj.common.util.StringUtil;
|
|
import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.redis.RedisService;
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.user.BadIntentionOpService;
|
|
import com.cyksj.service.user.BadIntentionOpService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
@@ -38,23 +39,30 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
|
|
|
private static final String VERIFY_URL = "https://captcha.luosimao.com/api/site_verify";
|
|
private static final String VERIFY_URL = "https://captcha.luosimao.com/api/site_verify";
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void checkHandleBadUserOp(String phone, String verifyCode) {
|
|
|
|
|
|
|
+ public void checkHandleBadUserOp(String phone, String verifyCode, String ticket, String randStr, HttpServletRequest request) {
|
|
|
if ("13662979985".equals(phone)) {
|
|
if ("13662979985".equals(phone)) {
|
|
|
throw BusinessRuntimeException.getInstance("异常手机号");
|
|
throw BusinessRuntimeException.getInstance("异常手机号");
|
|
|
}
|
|
}
|
|
|
- if (StringUtils.isBlank(verifyCode)) {
|
|
|
|
|
- throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
|
|
|
|
+// if (StringUtils.isBlank(verifyCode)) {
|
|
|
|
|
+// throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
|
|
+// } else {
|
|
|
|
|
+// //银河官网
|
|
|
|
|
+// JSONObject res = checkVerifyCode(apiKey, verifyCode);
|
|
|
|
|
+// if (!res.getStr("res").equals("success")) {
|
|
|
|
|
+// //小店域名
|
|
|
|
|
+// res = checkVerifyCode(shoppingApikey, verifyCode);
|
|
|
|
|
+// if (!res.getStr("res").equals("success")) {
|
|
|
|
|
+// log.error("手机号:{}验证码校验不通过 res:{}", phone, res);
|
|
|
|
|
+// throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+ if (ObjectUtil.hasEmpty(ticket, randStr)) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("请先完成图形认证");
|
|
|
} else {
|
|
} else {
|
|
|
- //银河官网
|
|
|
|
|
- JSONObject res = checkVerifyCode(apiKey, verifyCode);
|
|
|
|
|
- if (!res.getStr("res").equals("success")) {
|
|
|
|
|
- //小店域名
|
|
|
|
|
- res = checkVerifyCode(shoppingApikey, verifyCode);
|
|
|
|
|
- if (!res.getStr("res").equals("success")) {
|
|
|
|
|
- log.error("手机号:{}验证码校验不通过 res:{}", phone, res);
|
|
|
|
|
- throw BusinessRuntimeException.getInstance("人机校验不通过");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //腾讯云图形验证
|
|
|
|
|
+ String ip = StringUtil.getInternalAddressByIP(ServletUtil.getClientIP(request));
|
|
|
|
|
+ SmsUtil.checkTencentCaptcha(ticket, ip, randStr);
|
|
|
}
|
|
}
|
|
|
String dayKey = RedisService.key.PHONE_CODE_USER_NUM_KEY_DAY.getName() + phone;
|
|
String dayKey = RedisService.key.PHONE_CODE_USER_NUM_KEY_DAY.getName() + phone;
|
|
|
if (redisService.hasKey(RedisService.key.PHONE_CODE_BALCK_KEY.getName() + phone)) {
|
|
if (redisService.hasKey(RedisService.key.PHONE_CODE_BALCK_KEY.getName() + phone)) {
|