From 79e6967250bfaae1d5ff9584011f87a434f58a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8F=82=E7=8F=82?= Date: Mon, 18 Nov 2024 17:06:55 +0800 Subject: [PATCH] dev-1118-1706 --- packages/bydauto/src/Commands/BYDAutoCommand.php | 12 +++++++++--- packages/bydauto/src/Models/Testdrive.php | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/bydauto/src/Commands/BYDAutoCommand.php b/packages/bydauto/src/Commands/BYDAutoCommand.php index d6a52fb..a31a651 100644 --- a/packages/bydauto/src/Commands/BYDAutoCommand.php +++ b/packages/bydauto/src/Commands/BYDAutoCommand.php @@ -82,15 +82,21 @@ public function action_push2contact() $item->update(['status' => Testdrive::STATUS_REJECTED]); continue; } - $item->update(['status' => Testdrive::STATUS_PUBLISHED]); + $contact = $contacts[$offset]; + + $item->update([ + 'status' => Testdrive::STATUS_PUBLISHED, + 'contact_id' => $contact->id, + 'contact_info' => $contact->toArray(), + ]); + if (!isset($sendList[$contact->id])) { $sendList[$contact->id] = [$item]; } else { $sendList[$contact->id][] = $item; } - // info("分配试驾数据 {$item->id} 给联系人 {$contact->id}"); - // $this->info("分配试驾数据 {$item->id} 给联系人 {$contact->id}"); + Activity::create([ 'name' => '试驾通知', 'content' => ['testdrive' => $item->id, 'contact' => $contact->id], diff --git a/packages/bydauto/src/Models/Testdrive.php b/packages/bydauto/src/Models/Testdrive.php index 1ce2a33..4a89614 100644 --- a/packages/bydauto/src/Models/Testdrive.php +++ b/packages/bydauto/src/Models/Testdrive.php @@ -33,9 +33,12 @@ class Testdrive extends Model protected $table = 'bydauto_testdrive'; - protected $fillable = ['status', 'name', 'mobile', 'platform', 'source', 'meta', 'rawdata', 'request_id', 'external_id']; + protected $fillable = [ + 'status', 'name', 'mobile', 'platform', 'source', 'meta', + 'rawdata', 'request_id', 'external_id', 'contact_id', 'contact_info' + ]; - protected $casts = ['meta' => 'json', 'rawdata' => 'json']; + protected $casts = ['meta' => 'json', 'rawdata' => 'json', 'contact_info' => 'json']; // 行业运SPI接口数据处理 public static function isaas($data)