From 56e051ffe32f8aa076ca95a5b22056ab1e99c730 Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 20 Apr 2022 12:52:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8A=A9=E6=89=8B=E5=87=BD?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E4=BD=BF=E7=94=A8tp=E5=86=85=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E5=BA=93=E6=9B=BF=E6=8D=A2=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/service/curd/BuildCurdService.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/admin/service/curd/BuildCurdService.php b/app/admin/service/curd/BuildCurdService.php index 12d6179..9d2c420 100644 --- a/app/admin/service/curd/BuildCurdService.php +++ b/app/admin/service/curd/BuildCurdService.php @@ -301,7 +301,7 @@ class BuildCurdService } // 初始化默认模型名 - $this->modelFilename = ucfirst(CommonTool::lineToHump($this->table)); + $this->modelFilename = Str::studly($this->table); $this->buildViewJsUrl(); @@ -358,7 +358,7 @@ class BuildCurdService } } - $modelFilename = empty($modelFilename) ? ucfirst(CommonTool::lineToHump($relationTable)) : $modelFilename; + $modelFilename = empty($modelFilename) ? Str::studly($relationTable) : $modelFilename; $modelArray = explode($this->DS, $modelFilename); $modelName = array_pop($modelArray); @@ -580,7 +580,7 @@ class BuildCurdService $nodeArray = explode($this->DS, $this->controllerFilename); $formatArray = []; foreach ($nodeArray as $vo) { - $formatArray[] = CommonTool::humpToLine(lcfirst($vo)); + $formatArray[] = Str::snake($vo); } $this->controllerUrl = implode('.', $formatArray); $this->viewFilename = implode($this->DS, $formatArray); @@ -1009,7 +1009,7 @@ class BuildCurdService } else { $relationCode = ''; foreach ($this->relationArray as $key => $val) { - $relation = CommonTool::lineToHump($key); + $relation = Str::camel($key); $relationCode = "->withJoin('{$relation}', 'LEFT')\r"; } $controllerIndexMethod = CommonTool::replaceTemplate( @@ -1062,7 +1062,7 @@ class BuildCurdService } else { $relationList = ''; foreach ($this->relationArray as $key => $val) { - $relation = CommonTool::lineToHump($key); + $relation = Str::camel($key); $relationCode = CommonTool::replaceTemplate( $this->getTemplate("model{$this->DS}relation"), [ @@ -1116,7 +1116,7 @@ class BuildCurdService $relationModelClass = "\\app\\admin\\model\\{$val['modelFilename']}"; if (class_exists($relationModelClass) && method_exists(new $relationModelClass, 'getName')) { $tableName = (new $relationModelClass)->getName(); - if (CommonTool::humpToLine(lcfirst($tableName)) == CommonTool::humpToLine(lcfirst($key))) { + if (Str::snake($tableName) == Str::snake($key)) { continue; } } @@ -1375,7 +1375,7 @@ class BuildCurdService // 关联表 foreach ($this->relationArray as $table => $tableVal) { - $table = CommonTool::lineToHump($table); + $table = Str::camel($table); foreach ($tableVal['tableColumns'] as $field => $val) { if ($val['formType'] == 'image') { $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.image}";