From 84a8c3ab2e90865e89b5aaf514c8e47fb89a2911 Mon Sep 17 00:00:00 2001 From: Anyon Date: Sat, 19 Sep 2020 22:03:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B6=E4=B8=8D=E9=9C=80=E8=A6=81=E6=AF=8F?= =?UTF-8?q?=E6=AC=A1=E9=83=BD=E5=8E=BB=E6=B8=85=E7=90=86=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=8C=E5=8D=81=E5=88=86=E4=B9=8B=E4=B8=80=E6=A6=82=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/sys.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/admin/sys.php b/app/admin/sys.php index 90da9167c..0284c7486 100644 --- a/app/admin/sys.php +++ b/app/admin/sys.php @@ -27,8 +27,10 @@ app()->event->listen('HttpEnd', function () { app()->db->name('SystemOplog')->insertAll($items); } $GLOBALS['oplogs'] = []; - $lastdate = date('Y-m-d H:i:s', strtotime('-7days')); - app()->db->name('SystemOplog')->where('create_at', '<', $lastdate)->delete(); + if (rand(1, 100) <= 10) { + $lastdate = date('Y-m-d H:i:s', strtotime('-7days')); + app()->db->name('SystemOplog')->where('create_at', '<', $lastdate)->delete(); + } } });