代码优化

This commit is contained in:
wong
2025-07-11 16:47:50 +08:00
parent 9193004c54
commit 66c6455a44
3 changed files with 13 additions and 40 deletions

View File

@@ -916,17 +916,14 @@ class ContentLibraryController extends Controller
//执行切换好友命令
$automaticAssign = new AutomaticAssign();
$automaticAssign->allotWechatFriend(['wechatFriendId' => $friend['id'],'toAccountId' => $toAccountId],true);
//存入缓存
$friendData['friendId'] = $friend['id'];
artificialAllotWechatFriend($friendData);
//执行采集朋友圈命令
$webSocket = new WebSocketController(['userName' => $username,'password' => $password,'accountId' => $toAccountId]);
$webSocket->getMoments(['wechatFriendId' => $friend['id'],'wechatAccountId' => $friend['wechatAccountId']]);
//采集完毕切换
$res = $automaticAssign->allotWechatFriend(['wechatFriendId' => $friend['id'],'toAccountId' => $friend['accountId']],true);
$res = json_decode($res, true);
if($res == '无效路径或登录状态失效'){
$cacheFriend = $friend;
$cacheFriend['friendId'] = $friend['id'];
artificialAllotWechatFriend($friend);
}
$automaticAssign->allotWechatFriend(['wechatFriendId' => $friend['id'],'toAccountId' => $friend['accountId']],true);
}
@@ -1035,12 +1032,6 @@ class ContentLibraryController extends Controller
];
} catch (\Exception $e) {
$cacheFriend = $friendData;
$cacheFriend['friendId'] = $friend['id'];
artificialAllotWechatFriend($friend);
return [
'status' => 'error',
'message' => '采集过程发生错误: ' . $e->getMessage()