From 6f8ee42207060126dcfdc990f355c54172c534ac Mon Sep 17 00:00:00 2001 From: JaguarJack <82664165@qq.com> Date: Fri, 18 Jan 2019 10:00:08 +0800 Subject: [PATCH] =?UTF-8?q?log=20=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Base.php | 3 +- application/admin/controller/Log.php | 30 ++++++++++++++++++ application/model/BaseModel.php | 2 +- application/model/LogRecordModel.php | 22 ++++++++++++++ views/admin/log/index.html | 44 +++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 application/admin/controller/Log.php create mode 100644 views/admin/log/index.html diff --git a/application/admin/controller/Base.php b/application/admin/controller/Base.php index 226710f..1fa2045 100644 --- a/application/admin/controller/Base.php +++ b/application/admin/controller/Base.php @@ -9,7 +9,7 @@ abstract class Base extends Controller { use ControllerTrait; - protected $limit = 20; + protected $limit = 10; protected $page = 1; @@ -32,7 +32,6 @@ abstract class Base extends Controller unset($params[$key]); } } - $this->start = $this->start(); } diff --git a/application/admin/controller/Log.php b/application/admin/controller/Log.php new file mode 100644 index 0000000..6833fd7 --- /dev/null +++ b/application/admin/controller/Log.php @@ -0,0 +1,30 @@ +request->param(); + $this->checkParams($params); + + $this->list = $logRecordModel->getAll($params, $this->limit); + + return $this->fetch(); + } +} \ No newline at end of file diff --git a/application/model/BaseModel.php b/application/model/BaseModel.php index 41415b5..d3bf2d7 100644 --- a/application/model/BaseModel.php +++ b/application/model/BaseModel.php @@ -11,7 +11,7 @@ use think\Model; class BaseModel extends Model { - const LIMIT = 20; + const LIMIT = 10; /** * Store Data diff --git a/application/model/LogRecordModel.php b/application/model/LogRecordModel.php index ece53c6..d26dfb7 100644 --- a/application/model/LogRecordModel.php +++ b/application/model/LogRecordModel.php @@ -7,8 +7,30 @@ */ namespace app\model; +use http\Env\Request; + class LogRecordModel extends BaseModel { protected $name = 'option_log'; + /** + * 日志列表 + * + * @time at 2019年01月18日 + * @param array $params + * @param int $limit + * @return mixed + */ + public function getAll(array $params, $limit = self::LIMIT) + { + if (!count($params)) { + return $this->paginate($limit, false, ['query' => request()->param()]); + } + + if (isset($params['name'])) { + $list = $this->whereLike('user_name', '%'.$params['name'].'%'); + } + + return $list->paginate($limit, false, ['query' => request()->param()]); + } } \ No newline at end of file diff --git a/views/admin/log/index.html b/views/admin/log/index.html new file mode 100644 index 0000000..35518ed --- /dev/null +++ b/views/admin/log/index.html @@ -0,0 +1,44 @@ +{extend name="public:base" /} +{block name="menu"}日志列表{/block} +{block name="search"} +