diff --git a/app/admin/controller/system/CurdGenerate.php b/app/admin/controller/system/CurdGenerate.php index a237c14..d27d47b 100644 --- a/app/admin/controller/system/CurdGenerate.php +++ b/app/admin/controller/system/CurdGenerate.php @@ -137,6 +137,7 @@ class CurdGenerate extends AdminController $command = $request->post('command', ''); if (empty($command)) $this->error('请输入命令'); $commandExp = explode(' ', $command); + $commandExp = array_values(array_filter($commandExp)); try { $output = Console::call('curd', [...$commandExp]); diff --git a/app/admin/service/curd/BuildCurd.php b/app/admin/service/curd/BuildCurd.php index db248cc..d06bf8d 100644 --- a/app/admin/service/curd/BuildCurd.php +++ b/app/admin/service/curd/BuildCurd.php @@ -1040,7 +1040,7 @@ class BuildCurd $relation = CommonTool::lineToHump($key); $relationCode = "->withJoin('{$relation}', 'LEFT')\r"; if (!empty($val['bindSelectField']) && !empty($val['primaryKey'])) { - $constructRelation = '$notes["' . lcfirst($val['modelFilename']) . ucfirst($val['bindSelectField']) . '"] = \app\admin\model\\' . $val['modelFilename'] . '::column("' . $val['bindSelectField'] . '", "' . $val['primaryKey'] . '");'; + $constructRelation = '$notes["' . lcfirst($val['foreignKey']) . '"] = \app\admin\model\\' . $val['modelFilename'] . '::column("' . $val['bindSelectField'] . '", "' . $val['primaryKey'] . '");'; } } $controllerIndexMethod = CommonTool::replaceTemplate( @@ -1417,7 +1417,7 @@ class BuildCurd } elseif (in_array($field, $this->sortFields)) { $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', edit: 'text'}"; } else { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}'}"; + $templateValue = ""; } $indexCols .= $this->formatColsRow("{$templateValue},\r");