From 614b3fe9ca992b60823cff577259e89d45c0b8a5 Mon Sep 17 00:00:00 2001 From: xurongyao Date: Wed, 5 Sep 2018 15:46:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=B3=BB=E7=BB=9F=E6=97=A5?= =?UTF-8?q?=E5=BF=97=EF=BC=8C=E4=BF=9D=E5=AD=98=E6=9C=80=E8=BF=9190?= =?UTF-8?q?=E5=A4=A9?= 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 | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/application/admin/controller/system/SystemLog.php b/application/admin/controller/system/SystemLog.php index fef5e516..f27d4134 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 7b9d58ed..25b7a1c8 100644 --- a/application/admin/model/system/SystemLog.php +++ b/application/admin/model/system/SystemLog.php @@ -98,4 +98,12 @@ class SystemLog extends ModelBasic $model = $model->order('l.id desc'); return self::page($model,$where); } + /** + * 删除超过90天的日志 + */ + public static function deleteLog(){ + $model = new self; + $model->where('add_time','<',time()-7776000); + $model->delete(); + } } \ No newline at end of file