From 4c587572f0429479a9a9bb4009790deca06ef9b3 Mon Sep 17 00:00:00 2001 From: wolfcode <37436228+wolf-leo@users.noreply.github.com> Date: Tue, 7 Nov 2023 20:03:02 +0800 Subject: [PATCH] Update SystemLog.php --- app/admin/middleware/SystemLog.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/admin/middleware/SystemLog.php b/app/admin/middleware/SystemLog.php index 8dd47d8..2a3b7f5 100644 --- a/app/admin/middleware/SystemLog.php +++ b/app/admin/middleware/SystemLog.php @@ -3,6 +3,7 @@ namespace app\admin\middleware; use app\admin\service\annotation\ControllerAnnotation; +use app\admin\service\annotation\NodeAnnotation; use app\admin\service\SystemLogService; use app\Request; use app\admin\service\tool\CommonTool; @@ -50,17 +51,20 @@ class SystemLog try { $pathInfo = $request->pathinfo(); $pathInfoExp = explode('/', $pathInfo); + $_action = end($pathInfoExp) ?? ''; $pathInfoExp = explode('.', $pathInfoExp[0] ?? ''); - $_controller = $pathInfoExp[0] ?? ''; - $_action = ucfirst($pathInfoExp[1] ?? ''); - if ($_controller && $_action) { - $className = "app\admin\controller\\{$_controller}\\{$_action}"; + $_name = $pathInfoExp[0] ?? ''; + $_controller = ucfirst($pathInfoExp[1] ?? ''); + if ($_name && $_controller && $_action) { + $className = "app\admin\controller\\{$_name}\\{$_controller}"; $reflectionClass = new \ReflectionClass($className); $parser = new DocParser(); $parser->setIgnoreNotImportedAnnotations(true); $reader = new AnnotationReader($parser); $controllerAnnotation = $reader->getClassAnnotation($reflectionClass, ControllerAnnotation::class); - $title = $controllerAnnotation->title; + $reflectionAction = $reflectionClass->getMethod($_action); + $nodeAnnotation = $reader->getMethodAnnotation($reflectionAction, NodeAnnotation::class); + $title = $controllerAnnotation->title . ' - ' . $nodeAnnotation->title; } } catch (\Throwable $exception) { }