feat: 封禁用户状态仅更改一次

This commit is contained in:
张松
2024-12-30 13:14:59 +08:00
parent 6c02934e08
commit b8c0b8b2d9
3 changed files with 18 additions and 17 deletions

View File

@@ -79,9 +79,11 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
// 检查用户是否超过限流
if (redisService.checkIpJumpLimit(userId, ip)) {
log.warn("用户地址跳动频繁,封禁: {}", userId);
userService.update(null, new LambdaUpdateWrapper<UserEntity>()
.eq(UserEntity::getUserId, userId)
.set(UserEntity::getStatus, 0));
if (!redisService.isSetUserState(userId)) {
userService.update(null, new LambdaUpdateWrapper<UserEntity>()
.eq(UserEntity::getUserId, userId)
.set(UserEntity::getStatus, 0));
}
throw new CzgException("ip跳动过于频繁请联系管理员解封");
}