改名
This commit is contained in:
@@ -16,6 +16,7 @@ use HttpServer\Http\Formatter\JsonFormatter;
|
|||||||
use HttpServer\Http\Formatter\XmlFormatter;
|
use HttpServer\Http\Formatter\XmlFormatter;
|
||||||
use JetBrains\PhpStorm\Pure;
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Snowflake\Core\Help;
|
use Snowflake\Core\Help;
|
||||||
|
use Snowflake\Core\Json;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
use Swoole\Http\Response as SResponse;
|
use Swoole\Http\Response as SResponse;
|
||||||
use Swoole\Http2\Response as S2Response;
|
use Swoole\Http2\Response as S2Response;
|
||||||
@@ -217,6 +218,7 @@ class Response extends HttpService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param $response
|
||||||
* @param $sendData
|
* @param $sendData
|
||||||
* @param $status
|
* @param $status
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -226,11 +228,19 @@ class Response extends HttpService
|
|||||||
if (!swoole()->exist($response->fd)) {
|
if (!swoole()->exist($response->fd)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (is_array($sendData)) {
|
||||||
|
$sendData = Json::encode($sendData);
|
||||||
|
}
|
||||||
$response->end($this->setHeaders($response, $status)
|
$response->end($this->setHeaders($response, $status)
|
||||||
->setResponseContent($sendData));
|
->setResponseContent($sendData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $sendData
|
||||||
|
* @return string
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user