From 8d57dca79e5cc8263750cd358be70fdb1a5c98f8 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Tue, 27 May 2025 14:31:38 +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=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cunkebao/controller/ContentLibraryController.php | 7 ++++--- Server/application/job/WorkbenchAutoLikeJob.php | 8 +++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Server/application/cunkebao/controller/ContentLibraryController.php b/Server/application/cunkebao/controller/ContentLibraryController.php index 6a6b7d18..7c7ecf5b 100644 --- a/Server/application/cunkebao/controller/ContentLibraryController.php +++ b/Server/application/cunkebao/controller/ContentLibraryController.php @@ -862,7 +862,6 @@ class ContentLibraryController extends Controller 'message' => '没有指定要采集的好友' ]; } - try { $toAccountId = ''; $username = Env::get('api.username', ''); @@ -870,14 +869,15 @@ class ContentLibraryController extends Controller if (!empty($username) || !empty($password)) { $toAccountId = Db::name('users')->where('account',$username)->value('s2_accountId'); } - + + // 查询好友信息 $friends = Db::table('s2_wechat_friend') ->field('id, wechatAccountId, wechatId,accountId') ->whereIn('id', $friendIds) ->where('isDeleted', 0) ->select(); - + if (empty($friends)) { return [ 'status' => 'failed', @@ -911,6 +911,7 @@ class ContentLibraryController extends Controller 'wechatAccountId' => $friend['wechatAccountId'] ]) ->order('createTime', 'desc') + ->where('createTime', '>=', time() - 86400) ->select(); if (empty($moments)) { diff --git a/Server/application/job/WorkbenchAutoLikeJob.php b/Server/application/job/WorkbenchAutoLikeJob.php index 5fd920b7..058dd243 100644 --- a/Server/application/job/WorkbenchAutoLikeJob.php +++ b/Server/application/job/WorkbenchAutoLikeJob.php @@ -255,7 +255,7 @@ class WorkbenchAutoLikeJob // 查询未点赞的朋友圈 $moments = $this->getUnlikedMoments($friend['friendId']); - if (empty($moments)) { + if (empty($moments) || count($moments) == 0) { // 处理完毕切换回原账号 $automaticAssign->allotWechatFriend(['wechatFriendId' => $friend['friendId'], 'toAccountId' => $friend['accountId']], true); Log::info("好友 {$friend['friendId']} 没有需要点赞的朋友圈"); @@ -272,9 +272,6 @@ class WorkbenchAutoLikeJob $labels[] = $config['friendTags']; $webSocket->modifyFriendLabel(['wechatFriendId' => $friend['friendId'], 'wechatAccountId' => $friend['wechatAccountId'], 'labels' => $labels]); } - - // 每个好友只点赞一条朋友圈,然后退出 - break; } // 处理完毕切换回原账号 @@ -301,10 +298,11 @@ class WorkbenchAutoLikeJob ['wm.wechatFriendId', '=', $friendId], ['wali.id', 'null', null] ]) - ->where('wm.create_time', '>=', time() - 86400 * 3) + ->where('wm.create_time', '>=', time() - 86400 * 2) ->field('wm.id, wm.snsId') ->group('wali.wechatFriendId') ->order('wm.createTime DESC') + ->page(1,1) ->select(); }