改名
This commit is contained in:
@@ -51,9 +51,6 @@ class OnRequest extends Callback
|
|||||||
public function onHandler(Request $request, Response $response): mixed
|
public function onHandler(Request $request, Response $response): mixed
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$response->setStatusCode(200);
|
|
||||||
return $response->end('');
|
|
||||||
|
|
||||||
Coroutine::defer(function () {
|
Coroutine::defer(function () {
|
||||||
fire(Event::SYSTEM_RESOURCE_RELEASES);
|
fire(Event::SYSTEM_RESOURCE_RELEASES);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -152,18 +152,14 @@ class Response extends HttpService
|
|||||||
/**
|
/**
|
||||||
* @param string $context
|
* @param string $context
|
||||||
* @param int $statusCode
|
* @param int $statusCode
|
||||||
* @param null $appointResponse
|
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function send($context = '', $statusCode = 200, $appointResponse = null): mixed
|
public function send($context = '', $statusCode = 200): mixed
|
||||||
{
|
{
|
||||||
$sendData = $this->parseData($context);
|
$sendData = $this->parseData($context);
|
||||||
|
|
||||||
$response = Context::getContext('response');
|
$response = Context::getContext('response');
|
||||||
if ($appointResponse instanceof SResponse) {
|
|
||||||
$response = $appointResponse;
|
|
||||||
}
|
|
||||||
if ($response instanceof SResponse) {
|
if ($response instanceof SResponse) {
|
||||||
$this->sendData($response, $sendData, $statusCode);
|
$this->sendData($response, $sendData, $statusCode);
|
||||||
} else {
|
} else {
|
||||||
@@ -228,7 +224,7 @@ class Response extends HttpService
|
|||||||
*/
|
*/
|
||||||
private function sendData($response, $sendData, $status): void
|
private function sendData($response, $sendData, $status): void
|
||||||
{
|
{
|
||||||
if (!swoole()->exist($response->fd)) {
|
if (!Snowflake::getWebSocket()->exist($response->fd)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$response->end($this->setHeaders($response, $status)
|
$response->end($this->setHeaders($response, $status)
|
||||||
@@ -243,8 +239,8 @@ class Response extends HttpService
|
|||||||
*/
|
*/
|
||||||
private function setResponseContent($sendData): string
|
private function setResponseContent($sendData): string
|
||||||
{
|
{
|
||||||
$message = '[' . date('Y-m-d H:i:s') . ']' . $sendData . PHP_EOL . PHP_EOL;
|
// $message = '[' . date('Y-m-d H:i:s') . ']' . $sendData . PHP_EOL . PHP_EOL;
|
||||||
Snowflake::writeFile(storage('response.log'), $message, FILE_APPEND);
|
// Snowflake::writeFile(storage('response.log'), $message, FILE_APPEND);
|
||||||
return $sendData;
|
return $sendData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user