mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 15:02:47 +08:00
修复 自动生成 runtime模块的bug
This commit is contained in:
@@ -72,10 +72,12 @@ class Create
|
||||
// 创建模块目录
|
||||
mkdir(APP_PATH . $module);
|
||||
}
|
||||
// 创建配置文件和公共文件
|
||||
self::buildCommon($module);
|
||||
// 创建模块的默认页面
|
||||
self::buildHello($module);
|
||||
if ('runtime' != $module) {
|
||||
// 创建配置文件和公共文件
|
||||
self::buildCommon($module);
|
||||
// 创建模块的默认页面
|
||||
self::buildHello($module);
|
||||
}
|
||||
|
||||
// 创建子目录和文件
|
||||
foreach ($list as $path => $file) {
|
||||
@@ -100,13 +102,13 @@ class Create
|
||||
foreach ($file as $val) {
|
||||
$filename = $modulePath . $path . DS . Loader::parseName($val) . EXT;
|
||||
switch ($path) {
|
||||
case CONTROLLER_LAYER: // 控制器
|
||||
case CONTROLLER_LAYER: // 控制器
|
||||
$content = "<?php\nnamespace {$module}\\{$path};\n\nclass {$val} {\n\n}";
|
||||
break;
|
||||
case MODEL_LAYER: // 模型
|
||||
case MODEL_LAYER: // 模型
|
||||
$content = "<?php\nnamespace {$module}\\{$path};\n\nclass {$val} extends \Think\Model{\n\n}";
|
||||
break;
|
||||
case VIEW_LAYER: // 视图
|
||||
case VIEW_LAYER: // 视图
|
||||
$filename = $modulePath . $path . DS . Loader::parseName($val) . '.html';
|
||||
if (!is_dir(dirname($filename))) {
|
||||
// 创建目录
|
||||
@@ -132,7 +134,7 @@ class Create
|
||||
{
|
||||
$filename = APP_PATH . $module . DS . CONTROLLER_LAYER . DS . Config::get('default_module') . EXT;
|
||||
if (!is_file($filename)) {
|
||||
$content = file_get_contents(THINK_PATH . 'tpl/default_index.tpl');
|
||||
$content = file_get_contents(THINK_PATH . 'tpl' . DS . 'default_index.tpl');
|
||||
$content = str_replace('{$module}', $module, $content);
|
||||
if (!is_dir(APP_PATH . $module . DS . CONTROLLER_LAYER)) {
|
||||
mkdir(APP_PATH . $module . DS . CONTROLLER_LAYER);
|
||||
@@ -144,14 +146,14 @@ class Create
|
||||
// 创建模块公共文件
|
||||
protected static function buildCommon($module)
|
||||
{
|
||||
if (!is_file(APP_PATH . $module . DS.'common.php')) {
|
||||
file_put_contents(APP_PATH . $module . DS.'common.php', "<?php\n");
|
||||
if (!is_file(APP_PATH . $module . DS . 'common.php')) {
|
||||
file_put_contents(APP_PATH . $module . DS . 'common.php', "<?php\n");
|
||||
}
|
||||
if (!is_file(APP_PATH . $module . DS.'config.php')) {
|
||||
file_put_contents(APP_PATH . $module . DS.'config.php', "<?php\nreturn [\n\n];");
|
||||
if (!is_file(APP_PATH . $module . DS . 'config.php')) {
|
||||
file_put_contents(APP_PATH . $module . DS . 'config.php', "<?php\nreturn [\n\n];");
|
||||
}
|
||||
if (!is_file(APP_PATH . $module . DS.'alias.php')) {
|
||||
file_put_contents(APP_PATH . $module . DS.'alias.php', "<?php\nreturn [\n\n];");
|
||||
if (!is_file(APP_PATH . $module . DS . 'alias.php')) {
|
||||
file_put_contents(APP_PATH . $module . DS . 'alias.php', "<?php\nreturn [\n\n];");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user