添加好友优化
This commit is contained in:
@@ -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'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user