From 8c1fc717c137f3a414b9aab42bd21b60fe8453d1 Mon Sep 17 00:00:00 2001 From: bingcool <2437667702@qq.com> Date: Sun, 19 May 2019 21:34:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=A8=A1=E5=BC=8F,=E7=BC=93=E5=AD=98=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- score/Core/EventController.php | 4 ++-- score/Core/HttpRoute.php | 4 ++-- score/Core/Memory/ChannelManager.php | 3 --- score/Core/ServiceTrait.php | 3 +++ score/Core/Task/AsyncTask.php | 2 +- score/Websocket/WebsocketServer.php | 1 - 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/score/Core/EventController.php b/score/Core/EventController.php index ffdd3298..91ac64d5 100644 --- a/score/Core/EventController.php +++ b/score/Core/EventController.php @@ -123,7 +123,7 @@ public function afterRequest(callable $callback, $prepend = false) { return true; } }else { - throw new \Exception(__NAMESPACE__.'::'.__function__.' the first param of type is callable'); + throw new \Exception(__NAMESPACE__.'::'.__function__.' the first param of type must be seted callable'); } } @@ -195,7 +195,7 @@ public function pushComponentPools() { /** * beforeAction 在处理实际action之前执行 - * EventController不会执行该动作,所以继承与EventController不要调用该method + * EventController不会执行该动作,所以继承于EventController其他类不要调用该method * @return mixed */ public function _beforeAction() { diff --git a/score/Core/HttpRoute.php b/score/Core/HttpRoute.php index 596f7201..4bff48ef 100755 --- a/score/Core/HttpRoute.php +++ b/score/Core/HttpRoute.php @@ -235,7 +235,7 @@ public function invoke($module = null, $controller = null, $action = null) { $this->response->header('Content-Type','application/json; charset=UTF-8'); $query_string = isset($this->request->server['QUERY_STRING']) ? '?'.$this->request->server['QUERY_STRING'] : ''; if(isset($this->request->post) && !empty($this->request->post)) { - $post = json_encode($this->request->post,JSON_UNESCAPED_UNICODE); + $post = json_encode($this->request->post, JSON_UNESCAPED_UNICODE); $msg = "call {$class}::_beforeAction return false, forbiden continue call {$class}::{$action}, please checkout it ||| ".$this->request->server['REQUEST_URI'].$query_string.' post_data:'.$post; }else { $msg = "call {$class}::_beforeAction return false, forbiden continue call {$class}::{$action}, please checkout it ||| ".$this->request->server['REQUEST_URI'].$query_string; @@ -280,7 +280,7 @@ public function invoke($module = null, $controller = null, $action = null) { 'ret' => 500, 'msg' => $msg, 'data' => '' - ],JSON_UNESCAPED_UNICODE)); + ], JSON_UNESCAPED_UNICODE)); } }else { Application::getApp()->setEnd(); diff --git a/score/Core/Memory/ChannelManager.php b/score/Core/Memory/ChannelManager.php index 1377041b..4122d1bd 100644 --- a/score/Core/Memory/ChannelManager.php +++ b/score/Core/Memory/ChannelManager.php @@ -24,9 +24,6 @@ class ChannelManager { * @throws mixed */ public function addChannel(string $name, int $capacity = null) { - if(!class_exists('Swoole\\Coroutine\\Channel')) { - throw new \Exception("after swoole 4.3.0, \Swoole\channel is removed, you can not use it"); - } if(!isset($this->list[$name])) { if($capacity) { $chan = new \Swoole\Coroutine\Channel($capacity); diff --git a/score/Core/ServiceTrait.php b/score/Core/ServiceTrait.php index 896acac6..062f70f4 100755 --- a/score/Core/ServiceTrait.php +++ b/score/Core/ServiceTrait.php @@ -137,6 +137,9 @@ public static function getMomeryIncludeFiles() { * @return array */ public static function getConf() { + if(!empty(Swfy::$config)) { + return Swfy::$config; + } return BaseServer::getConf(); } diff --git a/score/Core/Task/AsyncTask.php b/score/Core/Task/AsyncTask.php index c5ba0bb1..b829569a 100644 --- a/score/Core/Task/AsyncTask.php +++ b/score/Core/Task/AsyncTask.php @@ -68,7 +68,7 @@ public static function registerTaskfinish($data, $task = null) { */ public static function finish($data, $task = null) { if(is_array($data)) { - $data = json_encode($data); + $data = json_encode($data, JSON_UNESCAPED_UNICODE); } if(BaseServer::isTaskEnableCoroutine() && $task instanceof \Swoole\Server\Task) { $task->finish($data); diff --git a/score/Websocket/WebsocketServer.php b/score/Websocket/WebsocketServer.php index bd583512..3725f146 100755 --- a/score/Websocket/WebsocketServer.php +++ b/score/Websocket/WebsocketServer.php @@ -192,7 +192,6 @@ public function start() { }); } - /** * finish 函数,异步任务完成 */