This commit is contained in:
as2252258@163.com
2021-04-20 00:34:25 +08:00
parent 3b9029ac29
commit 7960ca45ab
+5 -7
View File
@@ -530,18 +530,18 @@ class Node extends HttpService
{ {
try { try {
if ($this->handler instanceof Closure) { if ($this->handler instanceof Closure) {
return $this->runWith(...$param); return $this->runWith($this->handler, ...$param);
} }
/** @var HttpFilter $filter */ /** @var HttpFilter $filter */
$filter = Snowflake::app()->get('filter'); $filter = Snowflake::app()->get('filter');
$validator = $filter->check(get_class($this->handler[0]), $this->handler[1]); $validator = $filter->check(get_class($this->handler[0]), $this->handler[1]);
if (!($validator instanceof Validator)) { if (!($validator instanceof Validator)) {
return $this->runWith(...$param); return $this->runWith($this->callback, ...$param);
} }
if (!$validator->validation()) { if (!$validator->validation()) {
return Json::to(5005, $validator->getError()); return Json::to(5005, $validator->getError());
} }
return $this->runWith(...$param); return $this->runWith($this->callback, ...$param);
} catch (Throwable $throwable) { } catch (Throwable $throwable) {
$this->addError($throwable, 'throwable'); $this->addError($throwable, 'throwable');
@@ -556,11 +556,9 @@ class Node extends HttpService
* @return mixed * @return mixed
* @throws Exception * @throws Exception
*/ */
private function runWith(): mixed private function runWith($callback, ...$params): mixed
{ {
return ($this->callback)(...func_get_args()); return call_user_func($callback, ...$params);
return call_user_func($this->callback, ...func_get_args());
} }