From 2f0fd2e10f2470c83470cdb4770e2e84d56e3bac Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Mon, 7 Jul 2025 10:11:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A5=BD=E5=8F=8B=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Adapters/ChuKeBao/Adapter.php | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php b/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php index 2db45e6b4..e40abd607 100644 --- a/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php +++ b/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php @@ -154,18 +154,29 @@ class Adapter implements WeChatServiceInterface public function handleCustomerTaskWithStatusIsNew(int $current_worker_id, int $process_count_for_status_0) { - $tasks = Db::name('customer_acquisition_task')->alias('task') - ->join('task_customer customer','task.id=customer.task_id') - ->where(['task.status' => 1,'customer.status'=>0,'task.deleteTime' => 0]) - ->whereRaw("customer.id % $process_count_for_status_0 = {$current_worker_id}") - ->order('id DESC') + $task = Db::name('customer_acquisition_task') + ->where(['status' => 1,'deleteTime' => 0]) ->select(); + if (empty($task)) { + return false; + } + + $taskData = []; + foreach ($task as $item) { + $tasks = Db::name('task_customer') + ->where(['status'=> 0,'task_id'=>$item['id']]) + ->whereRaw("id % $process_count_for_status_0 = {$current_worker_id}") + ->order('id DESC') + ->limit(20) + ->select(); + $taskData = array_merge($taskData, $tasks); + } - if ($tasks) { + if ($taskData) { - foreach ($tasks as $task) { + foreach ($taskData as $task) { $task_id = $task['task_id'];