From 86ac5bdd3169a361da1f53f962a8363003766ba4 Mon Sep 17 00:00:00 2001 From: xurongyao Date: Mon, 17 Sep 2018 09:22:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BF=9D=E5=AD=98=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/system/SystemLog.php | 2 +- application/admin/model/system/SystemLog.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/application/admin/controller/system/SystemLog.php b/application/admin/controller/system/SystemLog.php index f27d4134..9fc943e1 100644 --- a/application/admin/controller/system/SystemLog.php +++ b/application/admin/controller/system/SystemLog.php @@ -1 +1 @@ -request); $where['level'] = $this->adminInfo['level']; $this->assign('where',$where); $this->assign('admin',SystemAdmin::getOrdAdmin('id,real_name',$this->adminInfo['level'])); $this->assign(LogModel::systemPage($where)); return $this->fetch(); } } \ No newline at end of file +request); $where['level'] = $this->adminInfo['level']; $this->assign('where',$where); $this->assign('admin',SystemAdmin::getOrdAdmin('id,real_name',$this->adminInfo['level'])); $this->assign(LogModel::systemPage($where)); return $this->fetch(); } } \ No newline at end of file diff --git a/application/admin/model/system/SystemLog.php b/application/admin/model/system/SystemLog.php index 25b7a1c8..5c4ea633 100644 --- a/application/admin/model/system/SystemLog.php +++ b/application/admin/model/system/SystemLog.php @@ -99,11 +99,13 @@ class SystemLog extends ModelBasic return self::page($model,$where); } /** + * @day * 删除超过90天的日志 */ - public static function deleteLog(){ + public static function deleteLog($day = 90){ $model = new self; - $model->where('add_time','<',time()-7776000); + $times = $day*86400; + $model->where('add_time','<',time()-$times); $model->delete(); } } \ No newline at end of file