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; } /**