mirror of https://gitee.com/stylefeng/roses
【8.3.0】【log】更新次数校验安全日志的记录
parent
e0bbf345b2
commit
458b6e8703
|
@ -14,6 +14,7 @@ import cn.stylefeng.roses.kernel.log.security.mapper.LogSecurityMapper;
|
|||
import cn.stylefeng.roses.kernel.log.security.service.LogSecurityService;
|
||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||
import cn.stylefeng.roses.kernel.security.api.CountValidatorApi;
|
||||
import cn.stylefeng.roses.kernel.security.api.exception.CountValidateException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -39,7 +40,7 @@ public class LogSecurityServiceImpl extends ServiceImpl<LogSecurityMapper, LogSe
|
|||
|
||||
@Override
|
||||
public void add(LogSecurityRequest logSecurityRequest) {
|
||||
|
||||
try {
|
||||
// 同一个IP一个小时内不能超过100条,防止刷接口
|
||||
countValidatorApi.countAndValidate(VALIDATE_COUNT_PREFIX + logSecurityRequest.getClientIp(),
|
||||
3600L, 100L);
|
||||
|
@ -47,6 +48,10 @@ public class LogSecurityServiceImpl extends ServiceImpl<LogSecurityMapper, LogSe
|
|||
LogSecurity logSecurity = new LogSecurity();
|
||||
BeanUtil.copyProperties(logSecurityRequest, logSecurity);
|
||||
this.save(logSecurity);
|
||||
|
||||
} catch (CountValidateException e) {
|
||||
// none
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue