From a668a0a55b889296668de791d603ac2072ee8e5a Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Wed, 21 May 2025 15:48:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8F=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/job/WorkbenchJob.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Server/application/job/WorkbenchJob.php b/Server/application/job/WorkbenchJob.php index 06096be5..247c5f91 100644 --- a/Server/application/job/WorkbenchJob.php +++ b/Server/application/job/WorkbenchJob.php @@ -196,8 +196,9 @@ class WorkbenchJob return; } - // 将好友列表分成10组 + // 将好友列表分成20组 $friendGroups = array_chunk($friendList, 10); + $processes = []; foreach ($friendGroups as $groupIndex => $friendGroup) { @@ -214,11 +215,9 @@ class WorkbenchJob } else { // 子进程 try { - // 重置数据库连接 - Db::close(); - Db::init(); - foreach ($friendGroup as $friend) { + Log::info("我是一个工作台子进程"); + // 验证是否达到点赞次数上限 $likeCount = $this->getTodayLikeCount($workbench, $config, $friend['deviceId']); if ($likeCount >= $config['maxLikes']) { @@ -233,14 +232,12 @@ class WorkbenchJob ->count(); if ($friendMaxLikes < $config['friendMaxLikes']) { + Log::info("工作台 {$workbench->id} 开始处理好友 {$friend['friendId']} 的朋友圈"); $this->processFriendMoments($workbench, $config, $friend); } } } catch (\Exception $e) { Log::error("工作台 {$workbench->id} 子进程异常: " . $e->getMessage()); - } finally { - // 确保关闭数据库连接 - Db::close(); } // 子进程执行完毕后退出