diff --git a/app/Controller/Admin/System.php b/app/Controller/Admin/System.php index c742119..5f33ad6 100644 --- a/app/Controller/Admin/System.php +++ b/app/Controller/Admin/System.php @@ -34,12 +34,32 @@ use Hyperf\HttpServer\Annotation\DeleteMapping; use Hyperf\HttpServer\Annotation\GetMapping; use Hyperf\HttpServer\Annotation\PostMapping; use Hyperf\HttpServer\Annotation\PutMapping; +use Hyperf\Swagger\Annotation as SA; #[Controller(prefix: "admin")] +#[SA\HyperfServer('user')] class System extends Base { #[GetMapping(path: "menu/list")] #[Auth(needAuth: false, auth: "menu:list")] + #[SA\Post(path: '/menu/list', summary: '菜单接口', tags: ['菜单接口'])] + #[SA\RequestBody( + description: '请求参数', + content: [ + new SA\MediaType( + mediaType: 'application/json', + schema: new SA\Schema( + required: ['username', 'age'], + properties: [ + new SA\Property(property: 'username', description: '用户名字段描述', type: 'string'), + new SA\Property(property: 'age', description: '年龄字段描述', type: 'string'), + new SA\Property(property: 'city', description: '城市字段描述', type: 'string'), + ] + ), + ), + ], + )] + #[SA\Response(response: 200, description: '返回值的描述')] public function menuList() { return $this->success("菜单列表", mModel::getMenus(1)); diff --git a/config/autoload/swagger.php b/config/autoload/swagger.php index 2a31013..6841328 100644 --- a/config/autoload/swagger.php +++ b/config/autoload/swagger.php @@ -8,62 +8,14 @@ return [ 'enable' => true, 'port' => (int)env("SWAGGER_PORT", 9500), 'json_dir' => BASE_PATH . '/static/swagger', - 'html' => <<<'HTML' - - -
- - - -