diff --git a/modules/Develop/Http/Controllers/ModuleController.php b/modules/Develop/Http/Controllers/ModuleController.php index c1bbcbc..9452765 100644 --- a/modules/Develop/Http/Controllers/ModuleController.php +++ b/modules/Develop/Http/Controllers/ModuleController.php @@ -4,6 +4,8 @@ namespace Modules\Develop\Http\Controllers; use Catch\Base\CatchController; use Catch\CatchAdmin; +use Catch\Contracts\ModuleRepositoryInterface; +use Catch\Exceptions\FailedException; use Catch\Support\Module\ModuleRepository; use Illuminate\Http\Request; use Illuminate\Support\Collection; @@ -97,10 +99,15 @@ class ModuleController extends CatchController * install * * @param Request $request + * @param ModuleRepositoryInterface $moduleRepository * @return true */ - public function install(Request $request) + public function install(Request $request, ModuleRepositoryInterface $moduleRepository) { + if ($moduleRepository->all()->pluck('name')->contains($request->get('title'))) { + throw new FailedException('模块已安装,无法再次安装'); + } + $moduleInstall = new ModuleInstall($request->get('type')); $moduleInstall->install($request->all()); diff --git a/modules/Develop/Support/ModuleInstall.php b/modules/Develop/Support/ModuleInstall.php index 8ad99bd..b4c89a0 100644 --- a/modules/Develop/Support/ModuleInstall.php +++ b/modules/Develop/Support/ModuleInstall.php @@ -51,7 +51,7 @@ class ModuleInstall $installer->install(); } catch (\Exception|\Throwable $e) { - CatchAdmin::deleteModulePath($title); + // CatchAdmin::deleteModulePath($title); throw new FailedException('安装失败: ' . $e->getMessage()); } diff --git a/modules/Develop/views/schema/steps/structure.vue b/modules/Develop/views/schema/steps/structure.vue index 8bf8028..9b9237f 100644 --- a/modules/Develop/views/schema/steps/structure.vue +++ b/modules/Develop/views/schema/steps/structure.vue @@ -129,7 +129,6 @@ onMounted(() => { onEnd({ newIndex, oldIndex }) { const newStructures = [] const s = structures.splice(oldIndex, newIndex - oldIndex) - console.log(s, structures, oldIndex, newIndex) s.concat(structures).forEach(item => { newStructures.push(item) })