From 0d8ccffddf1ab6e254034dc2eb4f1a02d09d4a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 5 Sep 2022 15:31:42 +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, 8 insertions(+), 7 deletions(-) diff --git a/GiiController.php b/GiiController.php index da6743f..9b1a2a4 100644 --- a/GiiController.php +++ b/GiiController.php @@ -73,6 +73,8 @@ use Kiri\Annotation\Route\Route; use Kiri\Annotation\Route\RequestMethod; use Kiri\Core\Str; use Kiri\Core\Json; +use Kiri\Message\Handler\CoreMiddleware; +use app\Components\Middleware\OAuthMiddleware; use Kiri\Message\Handler\Controller; use JetBrains\PhpStorm\ArrayShape; use {$model_namespace}\\{$managerName}; @@ -181,7 +183,7 @@ use {$model_namespace}\\{$managerName}; * @throws Exception */ #[Route(uri: "' . $_path . '/add", method: RequestMethod::REQUEST_POST)] - #[Middleware(middleware: [])] + #[Middleware(middleware: [CoreMiddleware::class, OAuthMiddleware::class])] public function actionAdd(): string { $model = new ' . $className . '(); @@ -236,7 +238,7 @@ use {$model_namespace}\\{$managerName}; * @throws Exception */ #[Route(uri: "' . $_path . '/update", method: RequestMethod::REQUEST_POST)] - #[Middleware(middleware: [])] + #[Middleware(middleware: [CoreMiddleware::class, OAuthMiddleware::class])] public function actionUpdate(): string { $model = ' . $className . '::findOne($this->request->post(\'id\', 0)); @@ -273,7 +275,7 @@ use {$model_namespace}\\{$managerName}; * @throws Exception */ #[Route(uri: "' . $_path . '/batch-delete", method: RequestMethod::REQUEST_POST)] - #[Middleware(middleware: [])] + #[Middleware(middleware: [CoreMiddleware::class, OAuthMiddleware::class])] public function actionBatchDelete(): string { $_key = $this->request->array(\'ids\'); @@ -310,7 +312,7 @@ use {$model_namespace}\\{$managerName}; * @throws Exception */ #[Route(uri: "' . $_path . '/detail", method: RequestMethod::REQUEST_POST)] - #[Middleware(middleware: [])] + #[Middleware(middleware: [CoreMiddleware::class, OAuthMiddleware::class])] public function actionDetail(): string { $model = ' . $managerName . '::findOne($this->request->query(\'id\')); @@ -342,7 +344,7 @@ use {$model_namespace}\\{$managerName}; * @throws Exception */ #[Route(uri: "' . $_path . '/delete", method: RequestMethod::REQUEST_POST)] - #[Middleware(middleware: [])] + #[Middleware(middleware: [CoreMiddleware::class, OAuthMiddleware::class])] public function actionDelete(): string { $_key = $this->request->int(\'id\', true); @@ -373,14 +375,13 @@ use {$model_namespace}\\{$managerName}; $_path = ltrim($_path,'/'); - return ' /** * @return string * @throws Exception */ #[Route(uri: "' . $_path . '/list", method: RequestMethod::REQUEST_GET)] - #[Middleware(middleware: [])] + #[Middleware(middleware: [CoreMiddleware::class, OAuthMiddleware::class])] public function actionList(): string { //分页处理