From 0e7453a6fe6c2b198375d080e7a0493bf99cbecd Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Wed, 24 Jun 2020 09:10:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9E=B6=E6=9E=84=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=B3=BB=E7=BB=9F=E6=A8=A1=E5=9D=97=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/system/SystemService.php | 21 +++++++++ catch/system/controller/DataDictionary.php | 2 +- catch/system/module.json | 7 ++- catch/system/route.php | 50 +++++++++++----------- 4 files changed, 53 insertions(+), 27 deletions(-) diff --git a/catch/system/SystemService.php b/catch/system/SystemService.php index ef90e0a..2c608cd 100644 --- a/catch/system/SystemService.php +++ b/catch/system/SystemService.php @@ -8,3 +8,24 @@ // +---------------------------------------------------------------------- // | Author: JaguarJack [ njphper@gmail.com ] // +---------------------------------------------------------------------- +namespace catchAdmin\system; + +use catchAdmin\system\events\AttachmentEvent; +use catcher\ModuleService; + +class SystemService extends ModuleService +{ + + public function loadRouteFrom() + { + // TODO: Implement loadRouteFrom() method. + return __DIR__ . DIRECTORY_SEPARATOR . 'route.php'; + } + + public function loadEvents() + { + return [ + 'attachment' => [ AttachmentEvent::class ], + ]; + } +} \ No newline at end of file diff --git a/catch/system/controller/DataDictionary.php b/catch/system/controller/DataDictionary.php index 1246c35..5c219bd 100644 --- a/catch/system/controller/DataDictionary.php +++ b/catch/system/controller/DataDictionary.php @@ -62,7 +62,7 @@ class DataDictionary extends CatchController */ public function view($table): \think\response\Json { - $fields = Db::query('show full columns from ' . $table); + $fields = Db::query(' ' . $table); array_walk($fields, function (&$item){ $item = array_change_key_case($item); diff --git a/catch/system/module.json b/catch/system/module.json index e5d44e9..a6f735d 100644 --- a/catch/system/module.json +++ b/catch/system/module.json @@ -4,8 +4,11 @@ "description": "", "keywords": [], "order": 2, - "services": [], + "services": [ + "catchAdmin\\system\\SystemService" + ], "aliases": {}, "files": [], - "requires": [] + "requires": [], + "enable": true } \ No newline at end of file diff --git a/catch/system/route.php b/catch/system/route.php index 90cab71..988f031 100644 --- a/catch/system/route.php +++ b/catch/system/route.php @@ -1,31 +1,33 @@ get('log/login', '\catchAdmin\system\controller\LoginLog@list'); -$router->delete('loginLog/empty', '\catchAdmin\system\controller\LoginLog@empty'); -// 操作日志 -$router->get('log/operate', '\catchAdmin\system\controller\OperateLog@list'); -$router->delete('operateLog/empty', '\catchAdmin\system\controller\OperateLog@empty'); +$router->group(function () use ($router){ + // 登录日志 + $router->get('log/login', '\catchAdmin\system\controller\LoginLog@list'); + $router->delete('loginLog/empty', '\catchAdmin\system\controller\LoginLog@empty'); + // 操作日志 + $router->get('log/operate', '\catchAdmin\system\controller\OperateLog@list'); + $router->delete('operateLog/empty', '\catchAdmin\system\controller\OperateLog@empty'); -// 数据字典 -$router->get('tables', '\catchAdmin\system\controller\DataDictionary@tables'); -$router->get('table/view/', '\catchAdmin\system\controller\DataDictionary@view'); -$router->post('table/optimize', '\catchAdmin\system\controller\DataDictionary@optimize'); -$router->post('table/backup', '\catchAdmin\system\controller\DataDictionary@backup'); + // 数据字典 + $router->get('tables', '\catchAdmin\system\controller\DataDictionary@tables'); + $router->get('table/view/
', '\catchAdmin\system\controller\DataDictionary@view'); + $router->post('table/optimize', '\catchAdmin\system\controller\DataDictionary@optimize'); + $router->post('table/backup', '\catchAdmin\system\controller\DataDictionary@backup'); -// 上传 -$router->post('upload/image', '\catchAdmin\system\controller\Upload@image'); -$router->post('upload/file', '\catchAdmin\system\controller\Upload@file'); + // 上传 + $router->post('upload/image', '\catchAdmin\system\controller\Upload@image'); + $router->post('upload/file', '\catchAdmin\system\controller\Upload@file'); -// 附件 -$router->resource('attachments', '\catchAdmin\system\controller\Attachments'); + // 附件 + $router->resource('attachments', '\catchAdmin\system\controller\Attachments'); -// 配置 -$router->get('config/parent', '\catchAdmin\system\controller\Config@parent'); -$router->resource('config', '\catchAdmin\system\controller\Config'); + // 配置 + $router->get('config/parent', '\catchAdmin\system\controller\Config@parent'); + $router->resource('config', '\catchAdmin\system\controller\Config'); -// 代码生成 -$router->post('generate', '\catchAdmin\system\controller\Generate@save'); -$router->post('generate/preview', '\catchAdmin\system\controller\Generate@preview'); // 预览 + // 代码生成 + $router->post('generate', '\catchAdmin\system\controller\Generate@save'); + $router->post('generate/preview', '\catchAdmin\system\controller\Generate@preview'); // 预览 -// 敏感词 -$router->resource('sensitive/word', '\catchAdmin\system\controller\SensitiveWord'); \ No newline at end of file + // 敏感词 + $router->resource('sensitive/word', '\catchAdmin\system\controller\SensitiveWord'); +})->middleware('auth'); \ No newline at end of file