From ff3bb5eb7459b24adb8e5f23f8d38e9339c941e4 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Fri, 30 May 2025 18:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=93=8D=E7=9B=98=E6=89=8B=E3=80=91?= =?UTF-8?q?=20=E8=87=AA=E5=8A=A8=E7=82=B9=E8=B5=9E=20---=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/job/WorkbenchAutoLikeJob.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Server/application/job/WorkbenchAutoLikeJob.php b/Server/application/job/WorkbenchAutoLikeJob.php index 58e013b45..ea03137a5 100644 --- a/Server/application/job/WorkbenchAutoLikeJob.php +++ b/Server/application/job/WorkbenchAutoLikeJob.php @@ -220,7 +220,7 @@ class WorkbenchAutoLikeJob $automaticAssign = new AutomaticAssign(); $automaticAssign->allotWechatFriend(['wechatFriendId' => $friend['friendId'], 'toAccountId' => $toAccountId], true); - // 执行采集朋友圈命令 + // 创建WebSocket链接 $webSocket = new WebSocketController(['userName' => $username, 'password' => $password, 'accountId' => $toAccountId]); // 查询未点赞的朋友圈 @@ -232,8 +232,6 @@ class WorkbenchAutoLikeJob } - - if (empty($moments) || count($moments) == 0) { // 处理完毕切换回原账号 $automaticAssign->allotWechatFriend(['wechatFriendId' => $friend['friendId'], 'toAccountId' => $friend['accountId']], true); @@ -251,16 +249,21 @@ class WorkbenchAutoLikeJob $labels = $this->getFriendLabels($friend); $labels[] = $config['friendTags']; $webSocket->modifyFriendLabel(['wechatFriendId' => $friend['friendId'], 'wechatAccountId' => $friend['wechatAccountId'], 'labels' => $labels]); + + //更新用户标签 + $friendData = Db::table('s2_wechat_friend')->where('id', $friend['friendId'])->find(); + Db::table('s2_wechat_friend')->where('id', $friend['friendId'])->update(['labels' => json_encode($labels,256)]); } + break; } // 处理完毕切换回原账号 $automaticAssign->allotWechatFriend(['wechatFriendId' => $friend['friendId'], 'toAccountId' => $friend['accountId']], true); } catch (\Exception $e) { // 异常情况下也要确保切换回原账号 + $automaticAssign = new AutomaticAssign(); $automaticAssign->allotWechatFriend(['wechatFriendId' => $friend['friendId'], 'toAccountId' => $friend['accountId']], true); - - Log::error("处理好友 {$friend['friendId']} 朋友圈失败: " . $e->getMessage()); + Log::error("处理好友 {$friend['friendId']} 朋友圈失败异常: " . $e->getMessage()); } }