diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index 233258dd..33f959bd 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -330,8 +330,8 @@ class Crud extends Command $controllerUrl = strtolower(implode('/', $controllerArr)); $controllerBaseName = strtolower(implode(DS, $controllerArr)); - //视图文件 - $viewDir = $adminPath . 'view' . DS . $controllerBaseName . DS; + //视图文件 -- 如果控制器名字为驼峰形式,目录名需要转为下划线 + $viewDir = $adminPath . 'view' . DS . strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', implode(DS, $controllerArr))) . DS; //最终将生成的文件路径 $javascriptFile = ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'backend' . DS . $controllerBaseName . '.js'; @@ -753,6 +753,7 @@ class Crud extends Command //表注释 $tableComment = $modelTableInfo['Comment']; + $tableCNName = mb_substr($tableComment, -1) == '表' ? mb_substr($tableComment, 0, -1) : $tableComment; $tableComment = mb_substr($tableComment, -1) == '表' ? mb_substr($tableComment, 0, -1) . '管理' : $tableComment; $modelInit = ''; @@ -774,6 +775,7 @@ class Crud extends Command 'modelTableTypeName' => $modelTableTypeName, 'validateName' => $validateName, 'tableComment' => $tableComment, + 'tableCNName' => $tableCNName, 'iconName' => $iconName, 'pk' => $priKey, 'order' => $order,