mirror of https://gitee.com/karson/fastadmin.git
优化API文档模板参数格式校验
parent
916722b139
commit
ab89d2d506
|
|
@ -37,6 +37,10 @@ class Api extends Command
|
||||||
$force = $input->getOption('force');
|
$force = $input->getOption('force');
|
||||||
$url = $input->getOption('url');
|
$url = $input->getOption('url');
|
||||||
$language = $input->getOption('language');
|
$language = $input->getOption('language');
|
||||||
|
$template = $input->getOption('template');
|
||||||
|
if (!preg_match("/^([a-z0-9]+)\.html\$/i", $template)) {
|
||||||
|
throw new Exception('template file not correct');
|
||||||
|
}
|
||||||
$language = $language ? $language : 'zh-cn';
|
$language = $language ? $language : 'zh-cn';
|
||||||
$langFile = $apiDir . 'lang' . DS . $language . '.php';
|
$langFile = $apiDir . 'lang' . DS . $language . '.php';
|
||||||
if (!is_file($langFile)) {
|
if (!is_file($langFile)) {
|
||||||
|
|
@ -51,7 +55,7 @@ class Api extends Command
|
||||||
}
|
}
|
||||||
// 模板文件
|
// 模板文件
|
||||||
$template_dir = $apiDir . 'template' . DS;
|
$template_dir = $apiDir . 'template' . DS;
|
||||||
$template_file = $template_dir . $input->getOption('template');
|
$template_file = $template_dir . $template;
|
||||||
if (!is_file($template_file)) {
|
if (!is_file($template_file)) {
|
||||||
throw new Exception('template file not found');
|
throw new Exception('template file not found');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue