Skip to content

解决同个分组,同个方法,不同控制器,左侧菜单方法显示不全的问题 #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Utility/AnnotationDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 .= "<sup class='deprecated'>已废弃</sup>";
}
$html .= "<h2 class='api-method {$currentGroupName}' id='{$currentGroupName}-{$methodName}'>{$apiTag->name}{$deprecated}</h2>{$this->CLRF}";
$html .= "<h2 class='api-method {$currentGroupName}' id='{$currentGroupName}-{$controllerName}-{$methodName}'>{$apiTag->name}{$deprecated}</h2>{$this->CLRF}";

$html .= "<h3 class='method-description'>基本信息</h3>{$this->CLRF}";
//兼容api指定
Expand Down