This commit is contained in:
2020-09-09 11:44:14 +08:00
parent cb7ae39786
commit f2b09eebf0
4 changed files with 56 additions and 5 deletions
+32
View File
@@ -12,6 +12,7 @@ use HttpServer\Route\Annotation\Annotation;
use Snowflake\Core\JSON;
use Snowflake\Event;
use Snowflake\Snowflake;
use Swoole\Coroutine;
/**
* Class Node
@@ -86,6 +87,19 @@ class Node extends Application
}
/**
* @param $response
* @return mixed|null
*/
public function afterDispatch($response)
{
return Coroutine::create(function ($response) {
$callback = Reduce::after($this->_after);
$callback(\request(), $response);
}, [$response]);
}
/**
* @return array
*/
@@ -95,6 +109,24 @@ class Node extends Application
}
/**
* @return array
*/
public function getAfters()
{
return $this->_after;
}
/**
* @return bool
*/
public function hasAfter()
{
return count($this->_after) > 0;
}
/**
* @return array
*/