This commit is contained in:
make
2025-07-11 22:21:22 +08:00
parent 42b4b9b239
commit b0030bfdd8
50 changed files with 216 additions and 169 deletions

View File

@@ -540,13 +540,13 @@ class SiteContext
// var_dump($intRequestTotalLimit10);
// 检查请求次数是否超过限制
if ($intRequestTotalLimit10 > 60 && !$arrVisitInfo['vil_is_spider']) {
if ($intRequestTotalLimit10 > 100 && !$arrVisitInfo['vil_is_spider']) {
throw new HttpException(404, 'Too Many Requests');
// abort(403, 'Too Many Requests');
}
// 拉黑
if ($intRequestTotalLimit100 > 100 && !$arrVisitInfo['vil_is_spider']) {
if ($intRequestTotalLimit100 > 200 && !$arrVisitInfo['vil_is_spider']) {
// 将 IP 加入黑名单集合
Cache::store('redis')->handler()->sAdd($strKeyBlacklist, $strIp);
// 设置黑名单过期时间1 天后自动移除)