This commit is contained in:
thinkphp
2018-01-13 22:11:39 +08:00
2 changed files with 5 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ class Config extends Command
protected function execute(Input $input, Output $output) protected function execute(Input $input, Output $output)
{ {
if ($input->hasArgument('module')) { if ($input->getArgument('module')) {
$module = $input->getArgument('module') . DS; $module = $input->getArgument('module') . DS;
} else { } else {
$module = ''; $module = '';

View File

@@ -44,7 +44,8 @@ class Schema extends Command
if ($input->hasOption('module')) { if ($input->hasOption('module')) {
$module = $input->getOption('module'); $module = $input->getOption('module');
// 读取模型 // 读取模型
$list = scandir(APP_PATH . $module . DS . 'model'); $path = APP_PATH . $module . DS . 'model';
$list = is_dir($path) ? scandir($path) : [];
$app = App::$namespace; $app = App::$namespace;
foreach ($list as $file) { foreach ($list as $file) {
if (0 === strpos($file, '.')) { if (0 === strpos($file, '.')) {
@@ -66,7 +67,8 @@ class Schema extends Command
$tables = Db::connect($config)->getTables($dbName); $tables = Db::connect($config)->getTables($dbName);
} elseif (!\think\Config::get('app_multi_module')) { } elseif (!\think\Config::get('app_multi_module')) {
$app = App::$namespace; $app = App::$namespace;
$list = scandir(APP_PATH . 'model'); $path = APP_PATH . 'model';
$list = is_dir($path) ? scandir($path) : [];
foreach ($list as $file) { foreach ($list as $file) {
if (0 === strpos($file, '.')) { if (0 === strpos($file, '.')) {
continue; continue;