init
All checks were successful
Deploy to Production / deploy (push) Successful in 26s

This commit is contained in:
珂珂 2024-11-15 16:44:35 +08:00
parent be98f7cf85
commit 3793130ce5

View File

@ -45,13 +45,25 @@ public function action_init()
// 同步试驾数据给到经销商联系人 按顺序每个联系人分配一个试驾数据
public function action_push2contact()
{
// 所有已发送的试驾数据
$sendItems = Testdrive::query()
->where('status', Testdrive::STATUS_PUBLISHED)
->pluck('mobile')
->toArray();
// 需要发送的试驾数据
$items = Testdrive::query()
->whereNotNull('source')
->where('status', Testdrive::STATUS_DRAFT)
->orderBy('id')
->get();
$items = $items->unique('mobile');
// 根据手机号码去除重
$items = $items->filter(function ($item) use ($sendItems) {
return !in_array($item->mobile, $sendItems);
});
// 联系人
$contacts = Contact::query()
->where('status', Contact::STATUS_PUBLISHED)
->orderBy('id')