From e69aec077640947c8e8f4219dc580b4e79267ef1 Mon Sep 17 00:00:00 2001 From: zhaoxiang Date: Tue, 23 Feb 2021 19:13:26 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E5=88=9D=E5=A7=8B=E5=8C=96=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/AutoBuildFile.php | 6 +++++- app/util/AutoBuild.php | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/command/AutoBuildFile.php b/app/command/AutoBuildFile.php index a05917b..b329c2e 100644 --- a/app/command/AutoBuildFile.php +++ b/app/command/AutoBuildFile.php @@ -39,6 +39,10 @@ class AutoBuildFile extends Command { $dsn['menu'] = strlen($input) ? $input : 1; if ($dsn['menu']) { + $output->comment('Please input menu fid (default 0):'); + $input = trim(fgets(fopen('php://stdin', 'r'))); + $dsn['fid'] = strlen($input) ? $input : 0; + $output->comment('Do you need to create a route? 1 or 0 (default 0):'); $input = trim(fgets(fopen('php://stdin', 'r'))); $dsn['route'] = strlen($input) ? $input : 0; @@ -56,7 +60,7 @@ class AutoBuildFile extends Command { $dsn['table'] = strlen($input) ? $input : 0; } - $output->comment('please choose module (1:admin;2:api, default 1):'); + $output->comment('Please choose module (1:admin;2:api, default 1):'); $input = trim(fgets(fopen('php://stdin', 'r'))); $dsn['module'] = strlen($input) ? $input : 1; diff --git a/app/util/AutoBuild.php b/app/util/AutoBuild.php index 7af3f74..05e4274 100644 --- a/app/util/AutoBuild.php +++ b/app/util/AutoBuild.php @@ -18,12 +18,21 @@ class AutoBuild { 'name' => '', // 唯一标识 'module' => 1, // 构建类型 1:admin;2:api 'table' => 0, // 是否创建表 - 'modelName' => '' // 表名称 + 'modelName' => '', // 表名称 + 'fid' => 0 // 父级ID ]; + private $basePath = ''; + public function run($config = []) { - $config = array_merge($this->config, $config); - dump($config); + $this->config = array_merge($this->config, $config); + + if ($this->config['module'] == 1) { + + } + if ($this->config['control'] && $this->config['name']) { + $this->buildControl(); + } } /**