From 3c3bfb7f0b4286ad76b1fb57946add6a0d601656 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Tue, 3 Aug 2021 02:40:00 +0800 Subject: [PATCH] modify --- Annotation/Aspect.php | 9 --------- HttpServer/Route/Node.php | 19 +++---------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/Annotation/Aspect.php b/Annotation/Aspect.php index 693ef5a6..8e42d7bd 100644 --- a/Annotation/Aspect.php +++ b/Annotation/Aspect.php @@ -33,15 +33,6 @@ defined('ASPECT_ERROR') or define('ASPECT_ERROR', 'Aspect annotation must implem */ public function execute(mixed $class, mixed $method = ''): bool { - // TODO: Change the autogenerated stub -// if (!in_array(IAspect::class, class_implements($this->aspect))) { -// throw new Exception(ASPECT_ERROR . IAspect::class); -// } -// /** @var Aop $aop */ -// $aop = Snowflake::getDi()->get(Aop::class); -// -// $aop->aop_add([$class, $method], $this->aspect); - return true; } diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 13659b15..7143042a 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace HttpServer\Route; +use Annotation\Aspect; use Annotation\Route\RpcProducer; use Closure; use Exception; @@ -180,23 +181,9 @@ class Node extends HttpService if (empty($aspect)) { return null; } - -// if ($this->path == '/user/attributes'){ -// [$controller, $action] = $this->handler; -// -// $aspect = Snowflake::getDi()->getMethodAttribute($controller::class, $action); -// -// var_dump($aspect); -// } - foreach ($aspect as $value) { - - $implements = class_implements($value); - if ($this->path == '/user/attributes') { - var_dump($value, $implements); - } - if (isset($implements[IAspect::class])) { - return $value; + if ($value instanceof Aspect) { + return di($value->aspect); } } return null;