This commit is contained in:
2020-12-15 19:17:42 +08:00
parent 4b8ad4d2f0
commit ff067cebd8
+7 -7
View File
@@ -9,14 +9,14 @@ use Closure;
use HttpServer\Http\Request; use HttpServer\Http\Request;
use Exception; use Exception;
use HttpServer\Application; use HttpServer\Application;
use HttpServer\Route\Annotation\Http;
use JetBrains\PhpStorm\Pure; use JetBrains\PhpStorm\Pure;
use ReflectionException; use ReflectionException;
use Snowflake\Core\JSON; use Snowflake\Core\JSON;
use Snowflake\Event;
use Snowflake\Exception\NotFindClassException; use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake; use Snowflake\Snowflake;
use Swoole\Coroutine; use Swoole\Coroutine;
use Throwable;
use function Input;
/** /**
* Class Node * Class Node
@@ -97,8 +97,8 @@ class Node extends Application
/** /**
* @param $response * @param null $response
* @return mixed|null * @return mixed
*/ */
public function afterDispatch($response = null): mixed public function afterDispatch($response = null): mixed
{ {
@@ -188,7 +188,7 @@ class Node extends Application
$object = Snowflake::createObject($rule); $object = Snowflake::createObject($rule);
if (!$object->handler()) { if (!$object->handler()) {
return false; return false;
}; }
} }
return true; return true;
} }
@@ -210,7 +210,7 @@ class Node extends Application
throw new Exception('method ' . $action . ' not exists at ' . $controller . '.'); throw new Exception('method ' . $action . ' not exists at ' . $controller . '.');
} }
return [$reflect->newInstance(), $action]; return [$reflect->newInstance(), $action];
} catch (\Throwable $exception) { } catch (Throwable $exception) {
$this->_error = $exception->getMessage(); $this->_error = $exception->getMessage();
$this->error($exception->getMessage(), 'router'); $this->error($exception->getMessage(), 'router');
return null; return null;
@@ -329,7 +329,7 @@ class Node extends Application
$_searchMatch = '/<(\w+)?:(.+)?>/'; $_searchMatch = '/<(\w+)?:(.+)?>/';
foreach ($this->childes as $key => $val) { foreach ($this->childes as $key => $val) {
if (preg_match($_searchMatch, $key, $match)) { if (preg_match($_searchMatch, $key, $match)) {
\Input()->addGetParam($match[1] ?? '--', $search); Input()->addGetParam($match[1] ?? '--', $search);
return $this->childes[$key]; return $this->childes[$key];
} }
} }