diff --git a/Attributes/Api.php b/Attributes/Api.php index d36c3a3..6007a65 100644 --- a/Attributes/Api.php +++ b/Attributes/Api.php @@ -14,15 +14,4 @@ use JetBrains\PhpStorm\ExpectedValues; class Api { - /** - * @param string $method - * @param string $uri - */ - public function __construct( - #[ExpectedValues(['GET', 'POST', 'PUT', 'DELETE'])] - public string $method = 'GET', - public string $uri = '') - { - - } } diff --git a/Controller/DemoController.php b/Controller/DemoController.php new file mode 100644 index 0000000..20edb6a --- /dev/null +++ b/Controller/DemoController.php @@ -0,0 +1,59 @@ +success(); + } + + /** + * 测试POST请求 + * + * @return ResponseInterface + */ + #[Api] + #[ApiBody('id', 'Integer', 'ID', true)] + #[ApiReturn('id', 'Integer', 'ID')] + #[ApiReturn('title', 'String', '标题')] + #[ApiReturn('describe', 'String', '描述')] + #[PostMapping(path: 'post')] + public function post(): ResponseInterface + { + return Response::json()->success(); + } + + + + + +} \ No newline at end of file