diff --git a/app/admin/controller/debug/Log.php b/app/admin/controller/debug/Log.php new file mode 100644 index 0000000..18f7e45 --- /dev/null +++ b/app/admin/controller/debug/Log.php @@ -0,0 +1,29 @@ + 'desc', + 'id' => 'asc', + ]; + + use \app\admin\traits\Curd; + + public function __construct(App $app) + { + parent::__construct($app); + + $this->model = new \app\admin\model\DebugLog(); + } +} diff --git a/app/admin/controller/system/Log.php b/app/admin/controller/system/Log.php deleted file mode 100644 index ea1501d..0000000 --- a/app/admin/controller/system/Log.php +++ /dev/null @@ -1,67 +0,0 @@ -model = new SystemLog(); - } - - /** - * @NodeAnotation(title="列表") - */ - public function index() - { - if ($this->request->isAjax()) { - if (input('selectFields')) { - return $this->selectList(); - } - [$page, $limit, $where, $excludeFields] = $this->buildTableParames(['month']); - - $month = (isset($excludeFields['month']) && !empty($excludeFields['month'])) - ? date('Ym',strtotime($excludeFields['month'])) - : date('Ym'); - - // todo TP6框架有一个BUG,非模型名与表名不对应时(name属性自定义),withJoin生成的sql有问题 - - $count = $this->model - ->setMonth($month) - ->with('admin') - ->where($where) - ->select(); - $list = $this->model - ->setMonth($month) - ->with('admin') - ->where($where) - ->page($page, $limit) - ->order($this->sort) - ->select(); - - $data = [ - 'code' => 0, - 'msg' => '', - 'count' => $count, - 'data' => $list, - ]; - return json($data); - } - return $this->fetch(); - } - -} \ No newline at end of file diff --git a/app/admin/model/DebugLog.php b/app/admin/model/DebugLog.php new file mode 100644 index 0000000..48a4b17 --- /dev/null +++ b/app/admin/model/DebugLog.php @@ -0,0 +1,17 @@ + 227, "pid" => 99999999, "title" => "后台首页", "icon" => "fa fa-home", "href" => "index/welcome", "params" => "", "target" => "_self", + "sort" => 0, "status" => 1, ), array( + "id" => 228, "pid" => 0, "title" => "系统管理", "icon" => "fa fa-cog", "href" => "", "params" => "", "target" => "_self", + "sort" => 0, "status" => 1, ), array( + "id" => 234, "pid" => 228, "title" => "菜单管理", "icon" => "fa fa-tree", "href" => "system.menu/index", "params" => "", "target" => "_self", + "sort" => 10, "status" => 1, ), array( + "id" => 244, "pid" => 228, "title" => "管理员管理", "icon" => "fa fa-user", "href" => "system.admin/index", "params" => "", "target" => "_self", + "sort" => 12, "status" => 1, ), array( + "id" => 245, "pid" => 228, "title" => "角色管理", "icon" => "fa fa-bitbucket-square", "href" => "system.auth/index", "params" => "", "target" => "_self", + "sort" => 11, "status" => 1, ), array( + "id" => 246, "pid" => 228, "title" => "节点管理", "icon" => "fa fa-list", "href" => "system.node/index", "params" => "", "target" => "_self", + "sort" => 9, "status" => 1, ), array( + "id" => 247, "pid" => 228, "title" => "配置管理", "icon" => "fa fa-asterisk", "href" => "system.config/index", "params" => "", "target" => "_self", + "sort" => 8, "status" => 1, ), array( + "id" => 248, "pid" => 228, "title" => "上传管理", "icon" => "fa fa-arrow-up", "href" => "system.uploadfile/index", "params" => "", "target" => "_self", + "sort" => 0, "status" => 1, ), array( + "id" => 249, "pid" => 0, "title" => "商城管理", "icon" => "fa fa-list", "href" => "", "params" => "", "target" => "_self", + "sort" => 0, "status" => 1, ), array( + "id" => 250, "pid" => 249, "title" => "商品分类", "icon" => "fa fa-calendar-check-o", "href" => "mall.cate/index", "params" => "", "target" => "_self", + "sort" => 0, "status" => 1, ), array( + "id" => 251, "pid" => 249, "title" => "商品管理", "icon" => "fa fa-list", "href" => "mall.goods/index", "params" => "", "target" => "_self", + "sort" => 0, "status" => 1, ), array( + "id" => 252, "pid" => 228, "title" => "快捷入口", "icon" => "fa fa-list", "href" => "system.quick/index", "params" => "", "target" => "_self", + "sort" => 0, "status" => 1, ), array( + "id" => 253, "pid" => 228, "title" => "日志管理", "icon" => "fa fa-connectdevelop", - "href" => "system.log/index", + "href" => "debug.log/index", "params" => "", "target" => "_self", + "sort" => 0, "status" => 1, ) ); + return $ul_system_menu; diff --git a/app/common/service/initAdminData/SystemNode.php b/app/admin/service/initAdminData/SystemNode.php similarity index 92% rename from app/common/service/initAdminData/SystemNode.php rename to app/admin/service/initAdminData/SystemNode.php index cdc2da4..5dad80f 100644 --- a/app/common/service/initAdminData/SystemNode.php +++ b/app/admin/service/initAdminData/SystemNode.php @@ -463,18 +463,54 @@ $ul_system_node = array( "is_auth" => 1, ), array( - "id" => 67, - "node" => "system.log", - "title" => "操作日志管理", + "id" => 69, + "node" => "debug.log", + "title" => "debug_log", "type" => 1, "is_auth" => 1, ), array( - "id" => 68, - "node" => "system.log/index", + "id" => 70, + "node" => "debug.log/index", "title" => "列表", "type" => 2, "is_auth" => 1, + ), + array( + "id" => 71, + "node" => "debug.log/add", + "title" => "添加", + "type" => 2, + "is_auth" => 1, + ), + array( + "id" => 72, + "node" => "debug.log/edit", + "title" => "编辑", + "type" => 2, + "is_auth" => 1, + ), + array( + "id" => 73, + "node" => "debug.log/delete", + "title" => "删除", + "type" => 2, + "is_auth" => 1, + ), + array( + "id" => 74, + "node" => "debug.log/export", + "title" => "导出", + "type" => 2, + "is_auth" => 1, + ), + array( + "id" => 75, + "node" => "debug.log/modify", + "title" => "属性修改", + "type" => 2, + "is_auth" => 1, ) ); + return $ul_system_node; diff --git a/app/common/service/initAdminData/SystemQuick.php b/app/admin/service/initAdminData/SystemQuick.php similarity index 100% rename from app/common/service/initAdminData/SystemQuick.php rename to app/admin/service/initAdminData/SystemQuick.php diff --git a/app/admin/view/debug/log/add.html b/app/admin/view/debug/log/add.html new file mode 100644 index 0000000..8143510 --- /dev/null +++ b/app/admin/view/debug/log/add.html @@ -0,0 +1,53 @@ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + +
+ +
+
\ No newline at end of file diff --git a/app/admin/view/debug/log/edit.html b/app/admin/view/debug/log/edit.html new file mode 100644 index 0000000..f7186b8 --- /dev/null +++ b/app/admin/view/debug/log/edit.html @@ -0,0 +1,53 @@ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + +
+ +
+
\ No newline at end of file diff --git a/app/admin/view/debug/log/index.html b/app/admin/view/debug/log/index.html new file mode 100644 index 0000000..6f778da --- /dev/null +++ b/app/admin/view/debug/log/index.html @@ -0,0 +1,15 @@ +
+
+ +
+
+
+ \ No newline at end of file diff --git a/app/admin/view/system/log/index.html b/app/admin/view/system/log/index.html deleted file mode 100644 index fb1b2cc..0000000 --- a/app/admin/view/system/log/index.html +++ /dev/null @@ -1,7 +0,0 @@ -
-
- -
-
-
\ No newline at end of file diff --git a/app/common/model/TimeModel.php b/app/common/model/TimeModel.php index 68b6871..89973d1 100644 --- a/app/common/model/TimeModel.php +++ b/app/common/model/TimeModel.php @@ -48,7 +48,7 @@ class TimeModel extends Model */ use SoftDelete; - protected $deleteTime = true; + protected $deleteTime = 'delete_time'; protected $defaultSoftDelete = 0; diff --git a/app/common/service/MenuService.php b/app/common/service/MenuService.php index 42622c6..00c8bff 100644 --- a/app/common/service/MenuService.php +++ b/app/common/service/MenuService.php @@ -41,7 +41,7 @@ class MenuService { $data = Db::name('system_menu') ->field('title,icon,href') - ->where("delete_time is null") + ->where("delete_time", 0) ->where('pid', MenuConstant::HOME_PID) ->find(); !empty($data) && $data['href'] = __url($data['href']); @@ -59,7 +59,7 @@ class MenuService { /** @var AuthService $authService */ $authServer = app(AuthService::class, ['adminId' => $this->adminId]); - return $this->buildMenuChild(0, $this->getMenuData(),$authServer); + return $this->buildMenuChild(0, $this->getMenuData(), $authServer); } private function buildMenuChild($pid, $menuList, AuthService $authServer) @@ -93,7 +93,7 @@ class MenuService { $menuData = Db::name('system_menu') ->field('id,pid,title,icon,href,target') - ->where("delete_time is null") + ->where("delete_time", 0) ->where([ ['status', '=', '1'], ['pid', '<>', MenuConstant::HOME_PID], @@ -105,5 +105,4 @@ class MenuService ->select(); return $menuData; } - -} \ No newline at end of file +} diff --git a/app/common/service/initAdminData/SystemAuthNode.php b/app/common/service/initAdminData/SystemAuthNode.php deleted file mode 100644 index 4f5f3aa..0000000 --- a/app/common/service/initAdminData/SystemAuthNode.php +++ /dev/null @@ -1,84 +0,0 @@ - 1, - "auth_id" => 6, - "node_id" => 1 - ), - array( - "id" => 2, - "auth_id" => 6, - "node_id" => 2 - ), - array( - "id" => 3, - "auth_id" => 6, - "node_id" => 9 - ), - array( - "id" => 4, - "auth_id" => 6, - "node_id" => 12 - ), - array( - "id" => 5, - "auth_id" => 6, - "node_id" => 18 - ), - array( - "id" => 6, - "auth_id" => 6, - "node_id" => 19 - ), - array( - "id" => 7, - "auth_id" => 6, - "node_id" => 21 - ), - array( - "id" => 8, - "auth_id" => 6, - "node_id" => 22 - ), - array( - "id" => 9, - "auth_id" => 6, - "node_id" => 29 - ), - array( - "id" => 10, - "auth_id" => 6, - "node_id" => 30 - ), - array( - "id" => 11, - "auth_id" => 6, - "node_id" => 38 - ), - array( - "id" => 12, - "auth_id" => 6, - "node_id" => 39 - ), - array( - "id" => 13, - "auth_id" => 6, - "node_id" => 45 - ), - array( - "id" => 14, - "auth_id" => 6, - "node_id" => 46 - ), - array( - "id" => 15, - "auth_id" => 6, - "node_id" => 52 - ), - array( - "id" => 16, - "auth_id" => 6, - "node_id" => 53 - ) -); -return $ul_system_auth_node; diff --git a/database/seeds/InitBaseAdminData.php b/database/seeds/InitBaseAdminData.php index 1a0bc7d..1d45697 100644 --- a/database/seeds/InitBaseAdminData.php +++ b/database/seeds/InitBaseAdminData.php @@ -3,7 +3,7 @@ use app\admin\model\SystemConfig; use app\admin\service\TriggerService; -use app\common\service\InitAdminService; +use app\admin\service\InitAdminService; use think\migration\Seeder; class InitBaseAdminData extends Seeder diff --git a/public/static/admin/js/debug/log.js b/public/static/admin/js/debug/log.js new file mode 100644 index 0000000..9f11979 --- /dev/null +++ b/public/static/admin/js/debug/log.js @@ -0,0 +1,48 @@ +define(["jquery", "easy-admin"], function ($, ea) { + + var init = { + table_elem: '#currentTable', + table_render_id: 'currentTableRenderId', + index_url: 'debug.log/index', + add_url: 'debug.log/add', + edit_url: 'debug.log/edit', + delete_url: 'debug.log/delete', + export_url: 'debug.log/export', + modify_url: 'debug.log/modify', + }; + + var Controller = { + + index: function () { + ea.table.render({ + init: init, + size: 'sm', + limit: 50, + cols: [[ + { type: 'checkbox' }, + { field: 'id', title: 'id' }, + { field: 'uid', title: 'uid', minWidth: 140 }, + { field: 'level', title: 'level' }, + { field: 'content', title: '日志内容', minWidth: 400, align: 'left', style: 'background-color:#eee' }, + { field: 'create_time', title: 'create_time', minWidth: 160 }, + { field: 'app_name', title: 'app_name' }, + { field: 'controller_name', title: 'controller_name', }, + { field: 'action_name', title: 'action_name' }, + ]], + toolbar: [ + 'refresh', + 'export' + ] + }); + + ea.listen(); + }, + add: function () { + ea.listen(); + }, + edit: function () { + ea.listen(); + }, + }; + return Controller; +}); \ No newline at end of file diff --git a/public/static/admin/js/system/log.js b/public/static/admin/js/system/log.js deleted file mode 100644 index 5bc8d3b..0000000 --- a/public/static/admin/js/system/log.js +++ /dev/null @@ -1,35 +0,0 @@ -define(["jquery", "easy-admin"], function ($, ea) { - - - var init = { - table_elem: '#currentTable', - table_render_id: 'currentTableRenderId', - index_url: 'system.log/index', - }; - - var Controller = { - index: function () { - var util = layui.util; - ea.table.render({ - init: init, - toolbar: ['refresh'], - cols: [[ - {field: 'id', width: 80, title: 'ID', search: false}, - {field: 'month', title: '日志月份', hide: true, search: 'time', timeType: 'month', searchValue: util.toDateString(new Date(), 'yyyy-MM')}, - {field: 'admin.username', minWidth: 80, title: '后台用户', search: false}, - {field: 'method', minWidth: 80, title: '请求方法'}, - {field: 'url', minWidth: 80, title: '路由地址'}, - {field: 'title', minWidth: 80, title: '日志标题'}, - {field: 'content', minWidth: 80, title: '操作内容'}, - {field: 'ip', minWidth: 80, title: 'IP地址'}, - {field: 'useragent', minWidth: 80, title: 'useragent'}, - {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'}, - ]], - }); - - ea.listen(); - }, - }; - - return Controller; -}); \ No newline at end of file