兼容切换好友功能
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user