From ffc60b936691477d4fe52829073de6fdfe253ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 17 Apr 2023 18:56:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GiiController.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/GiiController.php b/GiiController.php index 0174d52..05bcf7a 100644 --- a/GiiController.php +++ b/GiiController.php @@ -206,7 +206,7 @@ use Kiri\Router\Annotate\AutoController; $_path = ltrim($_path, '/'); - $this->getData($className, $fields); + $this->getData($path, $className, $fields); return ' /** @@ -471,7 +471,7 @@ use Kiri\Router\Annotate\AutoController; } - private function getData($formClass, $fields): string + private function getData($path, $formClass, $fields): string { $html = ''; @@ -588,13 +588,18 @@ use Kiri\Router\Annotate\AutoController; } $this->rules[$val['Field']] = $_field; } + + $path = str_replace('Controller', 'Form', $path['path']); if (!is_dir($_SERVER['PWD'] . '/app/Form/')) { mkdir($_SERVER['PWD'] . '/app/Form/'); } - if (!file_exists($_SERVER['PWD'] . '/app/Form/' . $formClass . 'Form.php')) { - touch($_SERVER['PWD'] . '/app/Form/' . $formClass . 'Form.php'); + if (!is_dir($path)) { + mkdir($path); } - file_put_contents($_SERVER['PWD'] . '/app/Form/' . $formClass . 'Form.php', '