eee
This commit is contained in:
@@ -367,6 +367,42 @@ class Router
|
||||
$routeCount = count($router->dump());
|
||||
|
||||
\Kiri::getLogger()->info("Annotation route rebuild: {$classCount} classes processed, {$dispatchCount} annotation routes dispatched, {$routeCount} total routes, {$errorCount} errors");
|
||||
|
||||
// 搜索特定路径的诊断日志,方便排查 404 问题
|
||||
$searchPaths = ['/headers'];
|
||||
foreach ($searchPaths as $searchPath) {
|
||||
$found = [];
|
||||
foreach ($manifestEntries as $path => $entry) {
|
||||
$classes = is_array($entry) && isset($entry['classes']) ? $entry['classes'] : [];
|
||||
foreach ($classes as $class) {
|
||||
try {
|
||||
$reflect = $container->getReflectionClass($class);
|
||||
foreach ($reflect->getMethods() as $method) {
|
||||
foreach ($method->getAttributes() as $attr) {
|
||||
if (in_array($attr->getName(), [
|
||||
\Kiri\Router\Annotate\Get::class,
|
||||
\Kiri\Router\Annotate\Post::class,
|
||||
\Kiri\Router\Annotate\Put::class,
|
||||
\Kiri\Router\Annotate\Delete::class,
|
||||
\Kiri\Router\Annotate\Route::class,
|
||||
])) {
|
||||
$instance = $attr->newInstance();
|
||||
$routePath = $instance->path ?? '';
|
||||
if (str_contains($routePath, 'header')) {
|
||||
$found[] = "{$class}::{$method->getName()} -> {$attr->getName()} path={$routePath} version={$instance->version}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Throwable) {}
|
||||
}
|
||||
}
|
||||
if (!empty($found)) {
|
||||
\Kiri::getLogger()->info("Annotation route search '{$searchPath}': " . implode(' | ', $found));
|
||||
} else {
|
||||
\Kiri::getLogger()->warning("Annotation route search '{$searchPath}': NO annotation found in any of {$classCount} classes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user