From 2d55cac6fd5a75813f486898e05c9028fe79631c Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Tue, 8 Jul 2025 10:32:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=88=87=E6=8D=A2=E5=A5=BD?= =?UTF-8?q?=E5=8F=8B=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/command/SwitchFriendsCommand.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Server/application/command/SwitchFriendsCommand.php b/Server/application/command/SwitchFriendsCommand.php index 422fb4bf..ec197d7e 100644 --- a/Server/application/command/SwitchFriendsCommand.php +++ b/Server/application/command/SwitchFriendsCommand.php @@ -50,19 +50,21 @@ class SwitchFriendsCommand extends Command $automaticAssign = new AutomaticAssign(); foreach ($toSwitch as $friend) { + $friendId = !empty($friend['friendId']) ? $friend['friendId'] : $friend['id']; $automaticAssign->allotWechatFriend([ - 'wechatFriendId' => $friend['friendId'], + 'wechatFriendId' => $friendId, 'toAccountId' => $friend['accountId'], ], true); - $output->writeln('切换好友:' . $friend['friendId'] . ' 到账号:' . $friend['accountId']); - $switchedIds[] = $friend['friendId']; + $output->writeln('切换好友:' . $friendId . ' 到账号:' . $friend['accountId']); + $switchedIds[] = $friendId; } // 过滤掉已切换的,保留未切换和新进来的 $newFriends = Cache::get($cacheKey, []); $updated = []; foreach ($newFriends as $friend) { - if (!in_array($friend['friendId'], $switchedIds)) { + $friendId = !empty($friend['friendId']) ? $friend['friendId'] : $friend['id']; + if (!in_array($friendId, $switchedIds)) { $updated[] = $friend; } }