refactor(admin): refactor model generation and improve array string handling

- Update CommonTool to fix array string formatting issue- Refactor model generation template to use getOptions method
This commit is contained in:
wolfcode
2025-03-27 14:58:32 +08:00
parent 8aba56c8c2
commit bc03616e43
2 changed files with 11 additions and 5 deletions

View File

@@ -7,11 +7,14 @@ use app\common\model\TimeModel;
class {{modelName}} extends TimeModel
{
protected $name = "{{table}}";
protected $table = "{{prefix_table}}";
protected $deleteTime = {{deleteTime}};
protected function getOptions(): array
{
return [
'name' => "{{table}}",
'table' => "{{prefix_table}}",
'deleteTime' => {{deleteTime}},
];
}
public array $notes = {{selectArrays}};

View File

@@ -100,6 +100,9 @@ class CommonTool
{
$arrayString = str_replace('array (', '[', $arrayString);
$arrayString = str_replace(')', ']', $arrayString);
$arrayString = str_replace('=>
[', '=> [', $arrayString);
return $arrayString;
}
}