From 1597b2b968c47c9f4e32293f8a37c0639d4171d2 Mon Sep 17 00:00:00 2001 From: koogua Date: Tue, 22 Mar 2022 17:58:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=AF=8F=E6=97=A5=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Views/setting/captcha.volt | 4 ++-- app/Http/Admin/Views/setting/site.volt | 4 ++-- app/Services/Logic/User/Console/Online.php | 15 ++++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/Http/Admin/Views/setting/captcha.volt b/app/Http/Admin/Views/setting/captcha.volt index 1cc7e71b..1b05a222 100644 --- a/app/Http/Admin/Views/setting/captcha.volt +++ b/app/Http/Admin/Views/setting/captcha.volt @@ -19,13 +19,13 @@
- +
- +
diff --git a/app/Http/Admin/Views/setting/site.volt b/app/Http/Admin/Views/setting/site.volt index 3afc35d1..a8f2deb2 100644 --- a/app/Http/Admin/Views/setting/site.volt +++ b/app/Http/Admin/Views/setting/site.volt @@ -52,13 +52,13 @@
- +
- +
diff --git a/app/Services/Logic/User/Console/Online.php b/app/Services/Logic/User/Console/Online.php index 3480323a..8c2b6842 100644 --- a/app/Services/Logic/User/Console/Online.php +++ b/app/Services/Logic/User/Console/Online.php @@ -88,19 +88,20 @@ class Online extends LogicService $cache = $this->getCache(); - $content = $cache->get($keyName); - - if ($content) return; - - $service = new SiteVisitPointHistory(); - - $service->handle($user); + if ($cache->exists($keyName)) return; + /** + * 先写入缓存,再处理访问积分,防止重复插入记录 + */ $tomorrow = strtotime($todayDate) + 86400; $lifetime = $tomorrow - time(); $cache->save($keyName, 1, $lifetime); + + $service = new SiteVisitPointHistory(); + + $service->handle($user); } }