修改增加日志

parent d498c249
...@@ -540,9 +540,9 @@ public class UserController implements IBaseController { ...@@ -540,9 +540,9 @@ public class UserController implements IBaseController {
* 向该ipv4添加错误计数器 * 向该ipv4添加错误计数器
*/ */
private void countErrorByIpv4() { private void countErrorByIpv4() {
if(!ValidationUtil.isAtDangerousTime()){ // if(!ValidationUtil.isAtDangerousTime()){
return; // return;
} // }
String ipv4 = getIp(); String ipv4 = getIp();
if (StringUtils.isNotBlank(ipv4) && !ValidationUtil.validateLocalIpv4(ipv4)) { if (StringUtils.isNotBlank(ipv4) && !ValidationUtil.validateLocalIpv4(ipv4)) {
String ipv4Key = getIpKey(getIp()); String ipv4Key = getIpKey(getIp());
...@@ -551,6 +551,7 @@ public class UserController implements IBaseController { ...@@ -551,6 +551,7 @@ public class UserController implements IBaseController {
stringRedisTemplate.opsForValue().set(ipv4Key, String.valueOf(0), Constants.IPV4_COUNT_MINUTES, TimeUnit.MINUTES); stringRedisTemplate.opsForValue().set(ipv4Key, String.valueOf(0), Constants.IPV4_COUNT_MINUTES, TimeUnit.MINUTES);
} }
Long count = stringRedisTemplate.opsForValue().increment(ipv4Key, 1L); Long count = stringRedisTemplate.opsForValue().increment(ipv4Key, 1L);
LOGGER.info("Count for Locked ip access:{}, count={}", ipv4, count);
if (count >= Constants.IPV4_LOCK_ON_COUNTS){ if (count >= Constants.IPV4_LOCK_ON_COUNTS){
String lockIpv4Key = getLockIpv4Key(ipv4); String lockIpv4Key = getLockIpv4Key(ipv4);
stringRedisTemplate.opsForValue().set(lockIpv4Key, Boolean.TRUE.toString(), Constants.IPV4_LOCK_MINUTES, TimeUnit.MINUTES); stringRedisTemplate.opsForValue().set(lockIpv4Key, Boolean.TRUE.toString(), Constants.IPV4_LOCK_MINUTES, TimeUnit.MINUTES);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment