From 577f0e029ff6999b88a96ebb1b1faa293e594ec5 Mon Sep 17 00:00:00 2001 From: chaz6chez Date: Fri, 15 Dec 2023 20:29:43 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=B3=A8=E5=86=8C=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=9C=AA=E6=A0=B9=E6=8D=AE=E9=85=8D=E7=BD=AE=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?enable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Process/InstanceRegistrarProcess.php | 1 - src/Provider/InstanceProvider.php | 30 +++++++++---------- .../plugin/workbunny/webman-nacos/app.php | 4 +-- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Process/InstanceRegistrarProcess.php b/src/Process/InstanceRegistrarProcess.php index e059b89..5ff34a0 100644 --- a/src/Process/InstanceRegistrarProcess.php +++ b/src/Process/InstanceRegistrarProcess.php @@ -101,7 +101,6 @@ public function onWorkerStart(Worker $worker) foreach ($instanceRegistrars as $name => $instanceRegistrar){ // 拆解配置 list($serviceName, $ip, $port, $option) = $instanceRegistrar; - $option['enabled'] = is_bool($option['enabled']) ? ($option['enabled'] ? 'true' : 'false') : $option['enabled']; // 注册 $promises[] = $this->client->instance->registerAsync($ip, $port, $serviceName, $option) ->then(function (ResponseInterface $response) use ($instanceRegistrar, $name) { diff --git a/src/Provider/InstanceProvider.php b/src/Provider/InstanceProvider.php index b8f6129..c3e6453 100644 --- a/src/Provider/InstanceProvider.php +++ b/src/Provider/InstanceProvider.php @@ -72,13 +72,13 @@ public function register(string $ip, int $port, string $serviceName, array $opti * @param int $port * @param string $serviceName * @param array $optional = [ - * 'groupName' => '', + * 'groupName' => '', * 'clusterName' => '', * 'namespaceId' => '', - * 'weight' => 99.0, - * 'metadata' => '', - * 'enabled' => true, - * 'ephemeral' => false, // 是否临时实例 + * 'weight' => 99.0, + * 'metadata' => '', + * 'enabled' => 'true', // 是否上线 + * 'ephemeral' => 'false', // 是否临时实例 * ] * @return bool|PromiseInterface * @throws GuzzleException @@ -103,10 +103,10 @@ public function registerAsync(string $ip, int $port, string $serviceName, array * 'groupName' => '', * 'clusterName' => '', * 'namespaceId' => '', - * 'weight' => 99.0, - * 'metadata' => '', - * 'enabled' => true, - * 'ephemeral' => false, // 是否临时实例 + * 'weight' => 99.0, + * 'metadata' => '', + * 'enabled' => 'true', // 是否上线 + * 'ephemeral' => 'false', // 是否临时实例 * ] * @param callable|null $success = function(\Workerman\Http\Response $response){} * @param callable|null $error = function(\Exception $exception){} @@ -228,8 +228,8 @@ public function deleteAsyncUseEventLoop(array $options, array $optional = [], ?c * 'namespaceId' => '', * 'weight' => 0.99, * 'metadata' => '', // json - * 'enabled' => false, - * 'ephemeral' => false, + * 'enabled' => 'false', + * 'ephemeral' => 'false', * ] * @return bool|string * @throws GuzzleException @@ -255,8 +255,8 @@ public function update(string $ip, int $port, string $serviceName, array $option * 'namespaceId' => '', * 'weight' => 0.99, * 'metadata' => '', // json - * 'enabled' => false, - * 'ephemeral' => false, + * 'enabled' => 'false', + * 'ephemeral' => 'false', * ] * @return bool|PromiseInterface * @throws GuzzleException @@ -284,8 +284,8 @@ public function updateAsync(string $ip, int $port, string $serviceName, array $o * 'namespaceId' => '', * 'weight' => 0.99, * 'metadata' => '', // json - * 'enabled' => false, - * 'ephemeral' => false, + * 'enabled' => 'false', + * 'ephemeral' => 'false', * ] * @param callable|null $success = function(\Workerman\Http\Response $response){} * @param callable|null $error = function(\Exception $exception){} diff --git a/src/config/plugin/workbunny/webman-nacos/app.php b/src/config/plugin/workbunny/webman-nacos/app.php index 94033f4..3e3986d 100644 --- a/src/config/plugin/workbunny/webman-nacos/app.php +++ b/src/config/plugin/workbunny/webman-nacos/app.php @@ -69,8 +69,8 @@ [ 'groupName' => 'DEFAULT_GROUP', 'namespaceId' => '', - 'enabled' => true, - 'ephemeral' => 'false' + 'enabled' => 'true', + 'ephemeral' => 'false' ], ], # 以下可以新增多个数组