From cbc351e7975453cb0841e35d3aae8e8781f9a339 Mon Sep 17 00:00:00 2001 From: chaz6chez Date: Fri, 17 May 2024 18:38:01 +0800 Subject: [PATCH] Fixed a bug where channels could not specify workerId publication --- src/Traits/ChannelMethods.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Traits/ChannelMethods.php b/src/Traits/ChannelMethods.php index 5c7459e..677e734 100644 --- a/src/Traits/ChannelMethods.php +++ b/src/Traits/ChannelMethods.php @@ -109,18 +109,18 @@ protected static function _ChPublish(string $key, mixed $message, bool $store = else { // 非指定workerId if ($workerId === null) { - if ($store or isset($channel[$workerId]['futureId'])) { - $channel[$workerId]['value'][] = $message; - } - } - // 指定workerId - else { foreach ($channel as $workerId => $item) { if ($store or isset($item['futureId'])) { $channel[$workerId]['value'][] = $message; } } } + // 指定workerId + else { + if ($store or isset($channel[$workerId]['futureId'])) { + $channel[$workerId]['value'][] = $message; + } + } } self::_Set($channelName, $channel);