|
@@ -27,11 +27,12 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
|
|
|
if ("13662979985".equals(phone)) {
|
|
if ("13662979985".equals(phone)) {
|
|
|
throw BusinessRuntimeException.getInstance("异常手机号");
|
|
throw BusinessRuntimeException.getInstance("异常手机号");
|
|
|
}
|
|
}
|
|
|
- String ip = StringUtil.getInternalAddressByIP(ServletUtil.getClientIP(request));
|
|
|
|
|
- log.info("--------------获取手机验证码------- ip:{}", ip);
|
|
|
|
|
|
|
+ String clientIP = ServletUtil.getClientIP(request);
|
|
|
|
|
+ String ipAddress = StringUtil.getInternalAddressByIP(clientIP);
|
|
|
|
|
+ log.info("--------------获取手机验证码------- ip:{} address:{}", clientIP, ipAddress);
|
|
|
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)) {
|
|
|
- log.error("--------------黑名单 手机号------- ip:{}", ip);
|
|
|
|
|
|
|
+ log.error("--------------黑名单 手机号------- ip:{} address:{}", clientIP, ipAddress);
|
|
|
throw BusinessRuntimeException.getInstance("异常手机号");
|
|
throw BusinessRuntimeException.getInstance("异常手机号");
|
|
|
}
|
|
}
|
|
|
if (redisService.hasKey(dayKey)) {
|
|
if (redisService.hasKey(dayKey)) {
|
|
@@ -52,9 +53,10 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void isBadOpLoginPhone(HttpServletRequest request, String phone) {
|
|
public void isBadOpLoginPhone(HttpServletRequest request, String phone) {
|
|
|
- String ip = StringUtil.getInternalAddressByIP(ServletUtil.getClientIP(request));
|
|
|
|
|
- log.info("--------------校验ip 是否黑名单------- ip:{}", ip);
|
|
|
|
|
- String blackIpKey = RedisService.key.BALCK_USER_IP_KEY + ip;
|
|
|
|
|
|
|
+ String clientIP = ServletUtil.getClientIP(request);
|
|
|
|
|
+ String ipAddress = StringUtil.getInternalAddressByIP(clientIP);
|
|
|
|
|
+ log.info("--------------校验ip 是否黑名单------- ip:{} ipAddress:{}", clientIP, ipAddress);
|
|
|
|
|
+ String blackIpKey = RedisService.key.BALCK_USER_IP_KEY + clientIP;
|
|
|
if (redisService.hasKey(blackIpKey)) {
|
|
if (redisService.hasKey(blackIpKey)) {
|
|
|
throw BusinessRuntimeException.getInstance("检测到您操作异常,请联系客服");
|
|
throw BusinessRuntimeException.getInstance("检测到您操作异常,请联系客服");
|
|
|
}
|
|
}
|
|
@@ -63,7 +65,7 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
|
|
|
int i = Integer.parseInt(redisService.get(RetryTimeKey).toString());
|
|
int i = Integer.parseInt(redisService.get(RetryTimeKey).toString());
|
|
|
if (i >= PHONE_LOGIN_CODE_RETRY) {
|
|
if (i >= PHONE_LOGIN_CODE_RETRY) {
|
|
|
//锁住他的ip
|
|
//锁住他的ip
|
|
|
- redisService.setNx(blackIpKey, ip, RedisService.key.BALCK_USER_IP_KEY.getTimeout());
|
|
|
|
|
|
|
+ redisService.setNx(blackIpKey, clientIP, RedisService.key.BALCK_USER_IP_KEY.getTimeout());
|
|
|
throw BusinessRuntimeException.getInstance("检测到您操作异常,请联系客服");
|
|
throw BusinessRuntimeException.getInstance("检测到您操作异常,请联系客服");
|
|
|
} else {
|
|
} else {
|
|
|
redisService.incr(RetryTimeKey, 1l);
|
|
redisService.incr(RetryTimeKey, 1l);
|