mirror of https://gitee.com/karson/fastadmin.git
commit
12a62eaa05
|
|
@ -26,6 +26,7 @@ class Api extends Command
|
||||||
->addOption('author', 'a', Option::VALUE_OPTIONAL, 'document author', $site['name'])
|
->addOption('author', 'a', Option::VALUE_OPTIONAL, 'document author', $site['name'])
|
||||||
->addOption('class', 'c', Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'extend class', null)
|
->addOption('class', 'c', Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'extend class', null)
|
||||||
->addOption('language', 'l', Option::VALUE_OPTIONAL, 'language', 'zh-cn')
|
->addOption('language', 'l', Option::VALUE_OPTIONAL, 'language', 'zh-cn')
|
||||||
|
->addOption('controller', 'r', Option::VALUE_REQUIRED | Option::VALUE_IS_ARRAY, 'controller name', null)
|
||||||
->setDescription('Build Api document from controller');
|
->setDescription('Build Api document from controller');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,16 +81,25 @@ 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;
|
||||||
|
$files = new \RecursiveIteratorIterator(
|
||||||
|
new \RecursiveDirectoryIterator($controllerDir),
|
||||||
|
\RecursiveIteratorIterator::LEAVES_ONLY
|
||||||
|
);
|
||||||
|
|
||||||
$controllerDir = $moduleDir . Config::get('url_controller_layer') . DS;
|
foreach ($files as $name => $file) {
|
||||||
$files = new \RecursiveIteratorIterator(
|
if (!$file->isDir() && $file->getExtension() == 'php') {
|
||||||
new \RecursiveDirectoryIterator($controllerDir),
|
$filePath = $file->getRealPath();
|
||||||
\RecursiveIteratorIterator::LEAVES_ONLY
|
$classes[] = $this->get_class_from_file($filePath);
|
||||||
);
|
}
|
||||||
|
}
|
||||||
foreach ($files as $name => $file) {
|
}
|
||||||
if (!$file->isDir() && $file->getExtension() == 'php') {
|
else{
|
||||||
$filePath = $file->getRealPath();
|
foreach ($controller as $index => $item) {
|
||||||
|
$filePath=$moduleDir . Config::get('url_controller_layer') . DS .$item.'.php';
|
||||||
$classes[] = $this->get_class_from_file($filePath);
|
$classes[] = $this->get_class_from_file($filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue