From 63b1cb472ac41685e20944e5827f2b3d3cf66b29 Mon Sep 17 00:00:00 2001 From: augushong Date: Fri, 10 Oct 2025 22:28:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=8C=89=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E3=80=81=E6=8E=A7=E5=88=B6=E5=99=A8=E3=80=81=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=9F=A5=E8=AF=A2=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/admin/controller/debug/LogBase.php | 40 ++++++++++++++++ extend/base/admin/view/debug/log/index.html | 33 +++++++++++++ extend/base/admin/view/debug/log/index.js | 47 ++++++++++++++++--- .../static/plugs/ulthon-admin/ulthon-admin.js | 3 -- 4 files changed, 113 insertions(+), 10 deletions(-) diff --git a/extend/base/admin/controller/debug/LogBase.php b/extend/base/admin/controller/debug/LogBase.php index 71ad073..96bb7ee 100644 --- a/extend/base/admin/controller/debug/LogBase.php +++ b/extend/base/admin/controller/debug/LogBase.php @@ -24,4 +24,44 @@ class LogBase extends AdminController $this->model = new \app\admin\model\DebugLog(); } + + /** + * @\app\admin\service\annotation\NodeAnotation(title="列表") + */ + public function index() + { + if ($this->request->isAjax()) { + if (input('selectFields')) { + return $this->selectList(); + } + list($page, $limit, $where, $excludes, $request_options, $group) = $this->buildTableParames(); + $count = $this->model + ->where($where) + ->group($group) + ->count(); + $list = $this->model + ->where($where) + ->page($page, $limit) + ->order($this->sort) + ->group($group) + ->select(); + $data = [ + 'code' => 0, + 'msg' => '', + 'count' => $count, + 'data' => $list, + ]; + + return json($data); + } + + $distinctData = $this->model->field('app_name, controller_name, action_name')->distinct(true)->select(); + $this->assign([ + 'apps' => array_unique($distinctData->column('app_name')), + 'controllers' => array_unique($distinctData->column('controller_name')), + 'actions' => array_unique($distinctData->column('action_name')), + ]); + + return $this->fetch(); + } } diff --git a/extend/base/admin/view/debug/log/index.html b/extend/base/admin/view/debug/log/index.html index 9be0f2b..6ddf56a 100644 --- a/extend/base/admin/view/debug/log/index.html +++ b/extend/base/admin/view/debug/log/index.html @@ -20,6 +20,39 @@ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
diff --git a/extend/base/admin/view/debug/log/index.js b/extend/base/admin/view/debug/log/index.js index 8aed879..ba006cb 100644 --- a/extend/base/admin/view/debug/log/index.js +++ b/extend/base/admin/view/debug/log/index.js @@ -22,16 +22,44 @@ $(function () { var sort = {}; sort[sortField] = order; if (sortField === 'uid') { - sort['id'] = 'asc' + sort['id'] = 'asc'; + } + + var requestData = { + page: page, + limit: limit, + sort: sort, + }; + + var filter = {}; + var op = {}; + + var appName = $('#app-select').val(); + if (appName) { + filter.app_name = appName; + op.app_name = '='; + } + + var controllerName = $('#controller-select').val(); + if (controllerName) { + filter.controller_name = controllerName; + op.controller_name = '='; + } + + var actionName = $('#action-select').val(); + if (actionName) { + filter.action_name = actionName; + op.action_name = '='; + } + + if (Object.keys(filter).length > 0) { + requestData.filter = JSON.stringify(filter); + requestData.op = JSON.stringify(op); } ua.request.get({ url: ua.url(init.indexUrl), - data: { - page: page, - limit: limit, - sort: sort - } + data: requestData }, function (res) { if (res.data && res.data.length > 0) { var html = ''; @@ -131,8 +159,13 @@ $(function () { reloadLogs(); }); + // 监听筛选条件选择 + layui.form.on('select(filter-select)', function (data) { + reloadLogs(); + }); + // 监听刷新按钮点击 - $('#refresh-btn').on('click', function() { + $('#refresh-btn').on('click', function () { reloadLogs(); }); }); \ No newline at end of file diff --git a/public/static/plugs/ulthon-admin/ulthon-admin.js b/public/static/plugs/ulthon-admin/ulthon-admin.js index 88e4d87..6621379 100644 --- a/public/static/plugs/ulthon-admin/ulthon-admin.js +++ b/public/static/plugs/ulthon-admin/ulthon-admin.js @@ -193,9 +193,6 @@ data: option.data, timeout: 60000, success: function (res) { - console.log(res); - console.log(option.statusName); - loading.hide(); if (eval('res.' + option.statusName) == option.statusCode) { return ok(res);