From 71fe4eee154e9cc4c3b7ae2ba18c21f933419275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 11 Sep 2020 18:53:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/DatabasesProviders.php | 2 +- Gii/Gii.php | 14 +++++- Gii/GiiInterceptor.php | 79 +++++++++++++++++++++++++++++++++ Gii/GiiLimits.php | 79 +++++++++++++++++++++++++++++++++ Gii/GiiMiddleware.php | 78 ++++++++++++++++++++++++++++++++ 5 files changed, 250 insertions(+), 2 deletions(-) create mode 100644 Gii/GiiInterceptor.php create mode 100644 Gii/GiiLimits.php create mode 100644 Gii/GiiMiddleware.php diff --git a/Database/DatabasesProviders.php b/Database/DatabasesProviders.php index c6153199..01669c11 100644 --- a/Database/DatabasesProviders.php +++ b/Database/DatabasesProviders.php @@ -31,7 +31,7 @@ class DatabasesProviders extends Providers /** * @param $name - * @return DatabasesProviders + * @return Connection * @throws ConfigException * @throws Exception */ diff --git a/Gii/Gii.php b/Gii/Gii.php index a2de1c78..0e6cb152 100644 --- a/Gii/Gii.php +++ b/Gii/Gii.php @@ -51,7 +51,7 @@ class Gii * @throws ConfigException * @throws Exception */ - public function run($db, $input) + public function run(?Connection $db, $input) { $this->input = $input; if (!empty($db)) $this->db = $db; @@ -65,6 +65,18 @@ class Gii $task = new GiiTask(); $task->setInput($this->input); return $task->generate(); + case 'interceptor': + $task = new GiiInterceptor(); + $task->setInput($this->input); + return $task->generate(); + case 'limits': + $task = new GiiLimits(); + $task->setInput($this->input); + return $task->generate(); + case 'middleware': + $task = new GiiMiddleware(); + $task->setInput($this->input); + return $task->generate(); default: return $this->getModel($make, $input); } diff --git a/Gii/GiiInterceptor.php b/Gii/GiiInterceptor.php new file mode 100644 index 00000000..46b6ae35 --- /dev/null +++ b/Gii/GiiInterceptor.php @@ -0,0 +1,79 @@ +input->get('name', null); + if (empty($managerName)) { + throw new Exception('文件名称不能为空~'); + } + $html = 'input->get('name', null); + if (empty($managerName)) { + throw new Exception('文件名称不能为空~'); + } + $html = 'input->get('name', null); + if (empty($managerName)) { + throw new Exception('文件名称不能为空~'); + } + $html = '