You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Plugins\ApiDoc\Controller;
|
|
|
|
|
|
|
|
use App\Util\Response;
|
|
|
|
use Hyperf\HttpServer\Annotation\Controller;
|
|
|
|
use Hyperf\HttpServer\Annotation\GetMapping;
|
|
|
|
use Hyperf\View\Render;
|
|
|
|
use Plugins\ApiDoc\Service\ApiDocService;
|
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 文档控制器
|
|
|
|
*
|
|
|
|
* Class DocumentController
|
|
|
|
*/
|
|
|
|
#[Controller('admin/plugins/api-doc')]
|
|
|
|
class DocumentController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param Render $render
|
|
|
|
*
|
|
|
|
* @return ResponseInterface
|
|
|
|
*/
|
|
|
|
#[GetMapping(path: 'view')]
|
|
|
|
public function view(Render $render): ResponseInterface
|
|
|
|
{
|
|
|
|
return $render->render("plugins.ApiDoc.Document.view");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 文档数据
|
|
|
|
*
|
|
|
|
* @return ResponseInterface
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
#[GetMapping(path: 'doc-data')]
|
|
|
|
public function doc(): ResponseInterface
|
|
|
|
{
|
|
|
|
return Response::json()->success(
|
|
|
|
ApiDocService::aop(false)->get()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|