From d5968a0991c0c0e0f6f1e3585b9f87e1489443a8 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Tue, 8 Jul 2025 11:56:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/command/SwitchFriendsCommand.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Server/application/command/SwitchFriendsCommand.php b/Server/application/command/SwitchFriendsCommand.php index ec197d7e..09b7c69b 100644 --- a/Server/application/command/SwitchFriendsCommand.php +++ b/Server/application/command/SwitchFriendsCommand.php @@ -34,7 +34,6 @@ class SwitchFriendsCommand extends Command do { $friends = Cache::get($cacheKey, []); - $original = $friends; $toSwitch = []; foreach ($friends as $friend) { @@ -51,12 +50,18 @@ class SwitchFriendsCommand extends Command $automaticAssign = new AutomaticAssign(); foreach ($toSwitch as $friend) { $friendId = !empty($friend['friendId']) ? $friend['friendId'] : $friend['id']; - $automaticAssign->allotWechatFriend([ + $res = $automaticAssign->allotWechatFriend([ 'wechatFriendId' => $friendId, 'toAccountId' => $friend['accountId'], ], true); - $output->writeln('切换好友:' . $friendId . ' 到账号:' . $friend['accountId']); - $switchedIds[] = $friendId; + $res = json_decode($res, true); + if ($res['code'] == 200){ + $output->writeln('切换好友:' . $friendId . ' 到账号:' . $friend['accountId']); + $switchedIds[] = $friendId; + }else{ + $output->writeln('切换好友:' . $friendId . ' 到账号:' . $friend['accountId'] .' 结果:' .$res['msg']); + } + sleep(1); } // 过滤掉已切换的,保留未切换和新进来的