diff --git a/catch/login/module.json b/catch/login/module.json index 7914452..ca2d7e0 100644 --- a/catch/login/module.json +++ b/catch/login/module.json @@ -1,7 +1,8 @@ { "name": "登陆", "alias": "login", - "description": "", + "description": "login 模块", + "version": "1.0.0", "keywords": [], "order": 1, "services": [ diff --git a/catch/permissions/controller/Permission.php b/catch/permissions/controller/Permission.php index 9f2ae71..02602cf 100644 --- a/catch/permissions/controller/Permission.php +++ b/catch/permissions/controller/Permission.php @@ -92,7 +92,7 @@ class Permission extends CatchController // 如果是父分类需要更新所有子分类的模块 if (!$permission->parent_id) { - $this->permissions->updateBy($permission->parent_id, [ + $this->permissions->updateBy($permission->id, [ 'module' => $permission->module, ], 'parent_id'); } diff --git a/catch/permissions/module.json b/catch/permissions/module.json index f78c9e4..9347e35 100644 --- a/catch/permissions/module.json +++ b/catch/permissions/module.json @@ -1,7 +1,8 @@ { "name": "权限管理", "alias": "permissions", - "description": "", + "description": "全县管理模块", + "version": "1.0.0", "keywords": [], "order": 2, "services": [ diff --git a/catch/system/module.json b/catch/system/module.json index a6f735d..e4398a6 100644 --- a/catch/system/module.json +++ b/catch/system/module.json @@ -1,14 +1,15 @@ { - "name": "系统管理", - "alias": "system", - "description": "", - "keywords": [], - "order": 2, - "services": [ - "catchAdmin\\system\\SystemService" - ], - "aliases": {}, - "files": [], - "requires": [], - "enable": true + "name": "系统管理", + "alias": "system", + "description": "系统管理模块", + "version": "1.0.0", + "keywords": [], + "order": 2, + "services": [ + "\\catchAdmin\\system\\SystemService" + ], + "aliases": [], + "files": [], + "requires": [], + "enable": true } \ No newline at end of file diff --git a/catch/wechat/module.json b/catch/wechat/module.json index 3b055c5..d46a960 100644 --- a/catch/wechat/module.json +++ b/catch/wechat/module.json @@ -2,6 +2,7 @@ "name": "微信管理", "alias": "wechat", "description": "catchadmin 微信管理模块", + "version": "1.0.0", "keywords": [ "wechat", "module" diff --git a/extend/catcher/command/CreateModuleCommand.php b/extend/catcher/command/CreateModuleCommand.php index b222f2c..49c0aee 100644 --- a/extend/catcher/command/CreateModuleCommand.php +++ b/extend/catcher/command/CreateModuleCommand.php @@ -16,6 +16,16 @@ class CreateModuleCommand extends Command protected $stubDir; + /** + * @var string + */ + protected $name; + + /** + * @var string + */ + protected $description; + protected $namespaces; protected function configure() @@ -30,6 +40,21 @@ class CreateModuleCommand extends Command try { $this->module = strtolower($input->getArgument('module')); + $this->name = $output->ask($input, '请输入模块中文名称'); + + if (!$this->name) { + while (true) { + $this->name = $output->ask($input, '请输入模块中文名称'); + if ($this->name) { + break; + } + } + } + + $this->description = $output->ask($input, '请输入模块描述'); + + $this->description = $this->description ? : ''; + $this->moduleDir = CatchAdmin::moduleDirectory($this->module); $this->stubDir = __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR; @@ -135,7 +160,9 @@ class CreateModuleCommand extends Command { $service = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'service.stub'); - $content = str_replace(['{NAMESPACE}', '{SERVICE}'], [substr($this->namespaces, 0, -1), ucfirst($this->module) . 'Service'], $service); + $content = str_replace(['{NAMESPACE}', '{SERVICE}'], + [substr($this->namespaces, 0, -1), + ucfirst($this->module) . 'Service'], $service); file_put_contents($this->moduleDir . ucfirst($this->module) . 'Service.php', $content); @@ -151,7 +178,9 @@ class CreateModuleCommand extends Command { $moduleJson = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'module.stub'); - $content = str_replace(['{MODULE}', '{SERVICE}'], [$this->module, '\\\\'. str_replace('\\', '\\\\',$this->namespaces . ucfirst($this->module) . 'Service')], $moduleJson); + $content = str_replace(['{NAME}','{DESCRIPTION}','{MODULE}', '{SERVICE}'], + [$this->name, $this->description, + $this->module, '\\\\'. str_replace('\\', '\\\\',$this->namespaces . ucfirst($this->module) . 'Service')], $moduleJson); file_put_contents($this->moduleDir . 'module.json', $content); } diff --git a/extend/catcher/command/stubs/module.stub b/extend/catcher/command/stubs/module.stub index e686ddd..bb3ff5b 100644 --- a/extend/catcher/command/stubs/module.stub +++ b/extend/catcher/command/stubs/module.stub @@ -1,7 +1,8 @@ { - "name": "", + "name": "{NAME}", "alias": "{MODULE}", - "description": "", + "description": "{DESCRIPTION}", + "version": "1.0.0", "keywords": [], "order": 0, "services": [