mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +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];");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ class Index
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
header('Content-Type:text/html; charset=utf-8');
|
||||
echo('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>!</p></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>');
|
||||
return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP5</b>!</p></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_55e75dfae343f5a1"></thinkad>';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user