From eaca195e7727f18d32aeb702e8977602716d3d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Sun, 1 Nov 2020 04:20:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Client/Result.php | 4 ++-- HttpServer/Server.php | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/HttpServer/Client/Result.php b/HttpServer/Client/Result.php index 99751ff0..c6e5673d 100644 --- a/HttpServer/Client/Result.php +++ b/HttpServer/Client/Result.php @@ -21,8 +21,8 @@ class Result public $code; public $message; public int $count = 0; - public array|string $data; - public array $header; + public ?array $data; + public ?array $header; public int $httpStatus = 200; public int $startTime = 0; diff --git a/HttpServer/Server.php b/HttpServer/Server.php index 20defdd9..ef554156 100644 --- a/HttpServer/Server.php +++ b/HttpServer/Server.php @@ -88,14 +88,22 @@ class Server extends Application $annotation->register('websocket', AWebsocket::class); $this->enableCoroutine((bool)Config::get('settings.enable_coroutine')); - foreach ($this->sortServers($configs) as $server) { + + $this->orders($configs); + $this->onProcessListener(); + return $this->getServer(); + } + + + private function orders($configs) + { + $servers = $this->sortServers($configs); + foreach ($servers as $server) { $this->create($server); if (!$this->baseServer) { return null; } } - $this->onProcessListener(); - return $this->getServer(); }