From e1e354ec9d81e3cba8d8a477385916902c17dd4a Mon Sep 17 00:00:00 2001 From: Qingyang Hu Date: Sun, 30 Sep 2018 08:57:43 +0800 Subject: [PATCH] Bug: fix counter --- src/Service/CacheService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Service/CacheService.php b/src/Service/CacheService.php index ce4d07c..704cd67 100644 --- a/src/Service/CacheService.php +++ b/src/Service/CacheService.php @@ -47,14 +47,14 @@ public function antiSpiderUse(User $user, int $target) { public function canSend(string $ip, string $target) { $current = (int)$this->client->get($this->getIdentifierForCode($ip)); - if($current > 5) + if($current >= 5) return false; $current ++; $this->client->set($this->getIdentifierForCode($ip), $current); $this->client->expire($this->getIdentifierForCode($ip), 1800); $current = (int)$this->client->get($this->getIdentifierForCode($target)); - if($current > 1) + if($current >= 1) return false; $current ++; $this->client->set($this->getIdentifierForCode($target), $current);