From 8da0b1b4b7c1584602eea81570be99c8f6061562 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Fri, 14 May 2021 09:48:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E5=AE=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/BaseController.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php index 4d848315d..dc48af7c0 100644 --- a/Application/Home/Controller/BaseController.class.php +++ b/Application/Home/Controller/BaseController.class.php @@ -442,14 +442,19 @@ class BaseController extends HomeController { $url = MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME; $urlKey = substr(md5($url), 8, 16); - $key = $loginer['id'] . ':' . $urlKey; + $key = 'promote_access_limit:' . $loginer['id'] . ':' . $urlKey; $check = Redis::exists($key); if ($check) { $count = Redis::incr($key); if ($count > 60) { - Log::write('user_access_limit:' . date('Y-m-d H:i:s') . ' ' . $key . '[' . $url . ']', 'INFO'); - $this->assign("ttl",Redis::ttl($key)); - $this->display("Index/accessLimit"); + Log::write('promote_access_limit:' . date('Y-m-d H:i:s') . ' ' . $key . '[' . $url . ']', 'INFO'); + $ttl = Redis::ttl($key); + if ($ttl == -1) { + Redis::incr($key); + Redis::expire($key, 60); + } + $this->assign('ttl', $ttl); + $this->display('Index/accessLimit'); die(); } } else {