增加可选api生成文档

pull/162/head
kingang 2019-12-21 15:10:05 +08:00
parent 63e0fb3fd5
commit efc92f71a9
1 changed files with 18 additions and 9 deletions

View File

@ -81,7 +81,9 @@ class Api extends Command
throw new Exception("Please make sure opcache already enabled, Get help:https://forum.fastadmin.net/d/1321"); throw new Exception("Please make sure opcache already enabled, Get help:https://forum.fastadmin.net/d/1321");
} }
} }
//控制器名
$controller = $input->getOption('controller') ?: '';
if(!$controller) {
$controllerDir = $moduleDir . Config::get('url_controller_layer') . DS; $controllerDir = $moduleDir . Config::get('url_controller_layer') . DS;
$files = new \RecursiveIteratorIterator( $files = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($controllerDir), new \RecursiveDirectoryIterator($controllerDir),
@ -94,6 +96,13 @@ class Api extends Command
$classes[] = $this->get_class_from_file($filePath); $classes[] = $this->get_class_from_file($filePath);
} }
} }
}
else{
foreach ($controller as $index => $item) {
$filePath=$moduleDir . Config::get('url_controller_layer') . DS .$item.'.php';
$classes[] = $this->get_class_from_file($filePath);
}
}
$classes = array_unique(array_filter($classes)); $classes = array_unique(array_filter($classes));
$config = [ $config = [