拉黑用户时 记录用户行为

This commit is contained in:
wangw 2025-01-09 11:41:59 +08:00
parent 7460f19592
commit 6c3899599b
1 changed files with 2 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package com.sqx.modules.app.interceptor; package com.sqx.modules.app.interceptor;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -94,9 +95,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
log.warn("用户地址跳动频繁,封禁: {}", userId); log.warn("用户地址跳动频繁,封禁: {}", userId);
if (!redisService.isSetUserState(userId)) { if (!redisService.isSetUserState(userId)) {
ThreadUtil.execAsync(() -> { ThreadUtil.execAsync(() -> {
userService.update(null, new LambdaUpdateWrapper<UserEntity>() userService.addBlackUser(userId,"IP频繁跳动");
.eq(UserEntity::getUserId, userId)
.set(UserEntity::getStatus, 0));
}); });
} }
throw new CzgException("ip跳动过于频繁请联系管理员解封"); throw new CzgException("ip跳动过于频繁请联系管理员解封");