From ee624300b6bb286181f284282bb3edd8aabf6a17 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Sat, 12 Sep 2020 17:22:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A8=A1=E5=9D=97=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/system/SystemService.php | 10 ++++ catch/system/controller/Module.php | 52 +++++++++++++++++++ catch/system/route.php | 14 +++-- extend/catcher/library/InstallLocalModule.php | 4 +- 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 catch/system/controller/Module.php diff --git a/catch/system/SystemService.php b/catch/system/SystemService.php index 2c608cd..7a20536 100644 --- a/catch/system/SystemService.php +++ b/catch/system/SystemService.php @@ -11,6 +11,8 @@ namespace catchAdmin\system; use catchAdmin\system\events\AttachmentEvent; +use catcher\command\MigrateRunCommand; +use catcher\command\SeedRunCommand; use catcher\ModuleService; class SystemService extends ModuleService @@ -28,4 +30,12 @@ class SystemService extends ModuleService 'attachment' => [ AttachmentEvent::class ], ]; } + + protected function registerCommands() + { + $this->commands([ + MigrateRunCommand::class, + SeedRunCommand::class, + ]); + } } \ No newline at end of file diff --git a/catch/system/controller/Module.php b/catch/system/controller/Module.php new file mode 100644 index 0000000..87e4721 --- /dev/null +++ b/catch/system/controller/Module.php @@ -0,0 +1,52 @@ +findModuleInPermissions() ? $install->enableModule() : $install->done(); + } else { + $install->disableModule(); + } + + return CatchResponse::success(); + } +} \ No newline at end of file diff --git a/catch/system/route.php b/catch/system/route.php index 3c71b86..59ac9aa 100644 --- a/catch/system/route.php +++ b/catch/system/route.php @@ -31,9 +31,15 @@ $router->group(function () use ($router) { // 敏感词 $router->resource('sensitive/word', '\catchAdmin\system\controller\SensitiveWord'); + + //developer路由 + $router->resource('developer', '\catchAdmin\system\controller\Developer')->middleware('auth'); + // 开发者认证 + $router->post('developer/authenticate', '\catchAdmin\system\controller\Developer@authenticate'); + + // 模块管理 + $router->get('modules', '\catchAdmin\system\controller\Module@index'); + $router->put('modules/', '\catchAdmin\system\controller\Module@disOrEnable'); })->middleware('auth'); -//developer路由 -$router->resource('developer', '\catchAdmin\system\controller\Developer')->middleware('auth'); -// 开发者认证 -$router->post('developer/authenticate', '\catchAdmin\system\controller\Developer@authenticate'); + diff --git a/extend/catcher/library/InstallLocalModule.php b/extend/catcher/library/InstallLocalModule.php index 74d9ad1..2759f1e 100644 --- a/extend/catcher/library/InstallLocalModule.php +++ b/extend/catcher/library/InstallLocalModule.php @@ -110,9 +110,9 @@ class InstallLocalModule * @throws \think\db\exception\ModelNotFoundException * @return bool */ - protected function findModuleInPermissions() + public function findModuleInPermissions() { - return Permissions::where('module', $this->module)->find() ? true : false; + return Permissions::withTrashed()->where('module', $this->module)->find() ? true : false; } /**