Skip to content

Commit

Permalink
refactor: update controller
Browse files Browse the repository at this point in the history
  • Loading branch information
doyouhaobaby committed Nov 29, 2020
1 parent c84c32a commit dc5fb50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions application/app/App/Controller/Api/Api.php
Expand Up @@ -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);
}
}
12 changes: 6 additions & 6 deletions application/app/App/Controller/Api/Web.php
Expand Up @@ -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';
}
}

0 comments on commit dc5fb50

Please sign in to comment.