From aae29752d22c97bfd28dbe5e05c08b4d43045fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 31 Aug 2020 01:39:28 +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 --- composer.json | 2 +- function.php | 9 +++++++-- http-server/config.php | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index fc63a170..e12fa797 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "framework/snowflake", + "name": "game-worker/snowflake", "description": "test framework", "authors": [ { diff --git a/function.php b/function.php index c1aebbe2..e2250731 100644 --- a/function.php +++ b/function.php @@ -4,6 +4,7 @@ defined('APP_PATH') or define('APP_PATH', __DIR__ . '/../../'); use HttpServer\Http\Response; use Snowflake\Snowflake; +use HttpServer\Http\Context; if (!function_exists('make')) { @@ -90,8 +91,12 @@ if (!function_exists('alias')) { } + if (!function_exists('name')) { + /** + * @param string $name + */ function name($name) { swoole_set_process_name($name); @@ -107,10 +112,10 @@ if (!function_exists('response')) { */ function response() { - if (!Snowflake::has('response')) { + if (!Context::hasContext('response')) { return make('response', Response::class); } - return Snowflake::get()->response; + return Context::getContext('response'); } } diff --git a/http-server/config.php b/http-server/config.php index 4242017c..ad54d3f8 100644 --- a/http-server/config.php +++ b/http-server/config.php @@ -11,6 +11,7 @@ use Swoole\WebSocket\Frame; return [ 'servers' => [ [ + 'id' => '', 'type' => Server::HTTP, 'host' => '127.0.0.1', 'port' => 9527, @@ -26,6 +27,7 @@ return [ ] ], [ + 'id' => '', 'type' => Server::PACKAGE, 'host' => '127.0.0.1', 'port' => 9628, @@ -45,6 +47,7 @@ return [ ] ], [ + 'id' => '', 'type' => Server::TCP, 'host' => '127.0.0.1', 'port' => 9629, @@ -68,6 +71,7 @@ return [ ] ], [ + 'id' => '', 'type' => Server::WEBSOCKET, 'host' => '127.0.0.1', 'port' => 9530,