From 1ac7b3cacf3873162dd84a8ed90fb2385eda60f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=82=E7=A6=8F?= <2581047041@qq.com> Date: Wed, 20 Oct 2021 16:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=90=8C=E4=B8=AA=E5=88=86?= =?UTF-8?q?=E7=BB=84=EF=BC=8C=E5=90=8C=E4=B8=AA=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E6=8E=A7=E5=88=B6=E5=99=A8=EF=BC=8C=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E8=8F=9C=E5=8D=95=E6=96=B9=E6=B3=95=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=85=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Utility/AnnotationDoc.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Utility/AnnotationDoc.php b/src/Utility/AnnotationDoc.php index 9384829..2a3363d 100644 --- a/src/Utility/AnnotationDoc.php +++ b/src/Utility/AnnotationDoc.php @@ -126,6 +126,11 @@ function buildAnnotationHtml(string $dirOrFile): array $methods = $objectAnnotation->getMethod(); ksort($methods); $controllerAnnotation = $objectAnnotation->getController(); + if(!$controllerAnnotation){ + $controllerName = 'default'; + }else{ + $controllerName = $controllerAnnotation->value; + } foreach ($methods as $methodName => $method) { //仅仅渲染有api标记的方法 $apiTag = $method->getApiTag(); @@ -135,12 +140,12 @@ function buildAnnotationHtml(string $dirOrFile): array $globalInfo = ''; } - $groupList[$currentGroupName][$method->getMethodName()] = $method; + $groupList[$currentGroupName][$controllerName.'-'.$method->getMethodName()] = $method; $deprecated = ''; if ($apiTag->deprecated) { $deprecated .= "已废弃"; } - $html .= "

{$apiTag->name}{$deprecated}

{$this->CLRF}"; + $html .= "

{$apiTag->name}{$deprecated}

{$this->CLRF}"; $html .= "

基本信息

{$this->CLRF}"; //兼容api指定