From 71617c2526f0b24f42516bc233be88db1267695a Mon Sep 17 00:00:00 2001 From: PPPSCN <35696959@qq.com> Date: Sat, 16 Feb 2019 19:54:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96CRUD=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20--=20=E5=A6=82=E6=9E=9C=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8=E5=90=8D=E5=AD=97=E4=B8=BA=E9=A9=BC=E5=B3=B0=E5=BD=A2?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E7=9B=AE=E5=BD=95=E5=90=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E8=BD=AC=E4=B8=BA=E4=B8=8B=E5=88=92=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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,