From 9a121ad437acc63337b395045657e65af7c9a5f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 31 Aug 2020 17:11:45 +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 --- http-server/Abstracts/BaseContext.php | 36 ------------------------- http-server/Route/Dispatch/Dispatch.php | 2 +- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/http-server/Abstracts/BaseContext.php b/http-server/Abstracts/BaseContext.php index c1f51642..8d16237c 100644 --- a/http-server/Abstracts/BaseContext.php +++ b/http-server/Abstracts/BaseContext.php @@ -10,40 +10,4 @@ use Swoole\Coroutine; abstract class BaseContext { protected static $pool = []; - - static function get($key) - { - $cid = Coroutine::getuid(); - if ($cid < 0) - { - return null; - } - if(isset(self::$pool[$cid][$key])){ - return self::$pool[$cid][$key]; - } - return null; - } - - static function put($key, $item) - { - $cid = Coroutine::getuid(); - if ($cid > 0) - { - self::$pool[$cid][$key] = $item; - } - - } - - static function delete($key = null) - { - $cid = Coroutine::getuid(); - if ($cid > 0) - { - if($key){ - unset(self::$pool[$cid][$key]); - }else{ - unset(self::$pool[$cid]); - } - } - } } diff --git a/http-server/Route/Dispatch/Dispatch.php b/http-server/Route/Dispatch/Dispatch.php index cd9e3345..4bcb29f9 100644 --- a/http-server/Route/Dispatch/Dispatch.php +++ b/http-server/Route/Dispatch/Dispatch.php @@ -67,7 +67,7 @@ class Dispatch } else { $controller = $this->handler; } - $controller->request = Context::get('request'); + $controller->request = Context::getContext('request'); $controller->headers = $controller->request->headers; $controller->input = $controller->request->params; }