From dc5fb503f75a5f84acde76f40a39ad2143ddf1dc Mon Sep 17 00:00:00 2001 From: XiangMin Liu <635750556@qq.com> Date: Sun, 29 Nov 2020 13:48:57 +0800 Subject: [PATCH] refactor: update controller --- application/app/App/Controller/Api/Api.php | 12 ++++++------ application/app/App/Controller/Api/Web.php | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/application/app/App/Controller/Api/Api.php b/application/app/App/Controller/Api/Api.php index 077147b6..ce7f0bf3 100644 --- a/application/app/App/Controller/Api/Api.php +++ b/application/app/App/Controller/Api/Api.php @@ -20,20 +20,20 @@ class Api { #[Route( - path: "/api/v1/petLeevelForApi/{petId:[A-Za-z]+}/", + path: "/api/v1/demo/{name:[A-Za-z]+}/", attributes: ["args1" => "hello", "args2" => "world"], )] - public function petLeevelForApi(string $petId): string + public function demo1(string $name): string { - return sprintf('Hi you,i am petLeevelForApi and it petId is %s', $petId); + return sprintf('Hi you, you name is %s in version 1', $name); } #[Route( - path: "/api/v2/withBind/{petId:[A-Za-z]+}/", + path: "/api/v2/demo/{name:[A-Za-z]+}/", middlewares: "api", )] - public function withBind(string $petId): string + public function demo2(string $name): string { - return sprintf('Hi you,i am withBind and it petId is %s', $petId); + return sprintf('Hi you,your name is %s in version 2', $name); } } diff --git a/application/app/App/Controller/Api/Web.php b/application/app/App/Controller/Api/Web.php index 4045597c..f7fe728c 100644 --- a/application/app/App/Controller/Api/Web.php +++ b/application/app/App/Controller/Api/Web.php @@ -20,18 +20,18 @@ class Web { #[Route( - path: "/web/v1/petLeevelForWeb/{petId:[A-Za-z]+}/", + path: "/web/v1/demo/{name:[A-Za-z]+}/", )] - public function petLeevelForWeb(string $petId): string + public function demo1(string $name): string { - return 'petLeevelForWeb '. $petId; + return sprintf('web demo, your name is %s'. $name); } #[Route( - path: "/web/v2/petLeevelV2Web/", + path: "/web/v2/demo/", )] - public function petLeevelV2ForWeb(): string + public function demo2(): string { - return 'petLeevelV2ForWeb'; + return 'web demo2'; } }