将日志写入的用户超时逻辑改为限定为同一个账号

This commit is contained in:
季圣华
2022-05-21 22:29:01 +08:00
parent a2061b1a32
commit 8108d639e7
4 changed files with 14 additions and 16 deletions

View File

@@ -150,10 +150,10 @@ public class LogService {
if(userId!=null) {
String clientIp = getLocalIp(request);
String createTime = Tools.getNow3();
Long count = logMapperEx.getCountByIpAndDate(moduleName, clientIp, createTime);
Long count = logMapperEx.getCountByIpAndDate(userId, moduleName, clientIp, createTime);
if(count > 0) {
//如果某1个IP在同1秒内连续操作两遍此时需要删除该redis记录使其退出防止恶意攻击
redisService.deleteObjectByKeyAndIp("clientIp", clientIp, "userId");
//如果某个用户某个IP在同1秒内连续操作两遍此时需要删除该redis记录使其退出防止恶意攻击
redisService.deleteObjectByUserAndIp(userId, clientIp);
} else {
Log log = new Log();
log.setUserId(userId);