提交代码

This commit is contained in:
wong
2025-06-27 16:43:43 +08:00
parent f118ba150e
commit adc3cf660f
2 changed files with 11 additions and 6 deletions

View File

@@ -46,6 +46,10 @@ class TaskServer extends Server
$adapter = new ChuKeBaoAdapter();
Log::info('Workerman进程' . $current_worker_id);
// 在一个进程里处理获客任务添加后的相关逻辑
if ($current_worker_id == self::PROCESS_COUNT - 1) {
Timer::add(60, function () use($adapter) {

View File

@@ -156,8 +156,10 @@ class Adapter implements WeChatServiceInterface
->where('status', 0)
->whereRaw("id % $process_count_for_status_0 = {$current_worker_id}")
->limit(50)
->order('id DESC')
->select();
if ($tasks) {
foreach ($tasks as $task) {
@@ -171,7 +173,6 @@ class Adapter implements WeChatServiceInterface
}
$wechatIdAccountIdMap = $this->getWeChatIdsAccountIdsMapByDeviceIds($task_info['reqConf']['device']);
if (empty($wechatIdAccountIdMap)) {
continue;
}
@@ -181,10 +182,10 @@ class Adapter implements WeChatServiceInterface
// 是否已经是好友的判断如果已经是好友直接break; 但状态还是维持1让另外一个进程处理发消息的逻辑
$isFriend = $this->checkIfIsWeChatFriendByPhone($wechatId, $task['phone']);
if ($isFriend) {
$task['processed_wechat_ids'] = $task['processed_wechat_ids'] . ',' . $wechatId; // 处理失败任务用,用于过滤已处理的微信号
break;
}
// if ($isFriend) {
// $task['processed_wechat_ids'] = $task['processed_wechat_ids'] . ',' . $wechatId; // 处理失败任务用,用于过滤已处理的微信号
// break;
// }
// 判断时间间隔\时间段和最后一次的状态
$canCreateFriendAddTask = $this->checkIfCanCreateFriendAddTask($wechatId, $task_info['reqConf']);
@@ -428,7 +429,7 @@ class Adapter implements WeChatServiceInterface
// 先读取缓存
$task_info = cache('task_info_' . $id);
if (!empty($task_info)) {
if (empty($task_info)) {
$task_info = Db::name('customer_acquisition_task')
->where('id', $id)
->find();