diff --git a/app/Mail/HelloMail.php b/app/Mail/HelloMail.php index 7f523c2..d229d48 100644 --- a/app/Mail/HelloMail.php +++ b/app/Mail/HelloMail.php @@ -3,7 +3,6 @@ namespace App\Mail; use Illuminate\Bus\Queueable; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Envelope; @@ -11,12 +10,10 @@ class HelloMail extends Mailable { - use Queueable, SerializesModels; + use Queueable; + use SerializesModels; - public function __construct(protected $name) - { - // - } + public function __construct(protected $name) {} public function envelope(): Envelope { diff --git a/app/Notifications/HelloNotification.php b/app/Notifications/HelloNotification.php index f34bebb..a55c6e2 100644 --- a/app/Notifications/HelloNotification.php +++ b/app/Notifications/HelloNotification.php @@ -3,7 +3,6 @@ namespace App\Notifications; use Illuminate\Bus\Queueable; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; @@ -11,10 +10,7 @@ class HelloNotification extends Notification { use Queueable; - public function __construct(protected $name) - { - // - } + public function __construct(protected $name) {} /** * Get the notification's delivery channels. @@ -47,7 +43,6 @@ public function toMail(object $notifiable): MailMessage public function toArray(object $notifiable): array { return [ - // ]; } } diff --git a/packages/bydauto/src/Commands/AliPromotepageCommand.php b/packages/bydauto/src/Commands/AliPromotepageCommand.php index 33c7147..e5f37e5 100644 --- a/packages/bydauto/src/Commands/AliPromotepageCommand.php +++ b/packages/bydauto/src/Commands/AliPromotepageCommand.php @@ -2,10 +2,10 @@ namespace BYDAuto\Commands; -use Carbon\Carbon; use BYDAuto\Foundation\AlipayEasySDKFactory; use BYDAuto\Models\PromotePage; use BYDAuto\Models\Testdrive; +use Carbon\Carbon; use Illuminate\Console\Command; /** @@ -66,7 +66,7 @@ public function download($promote_page_id) $respList = $resp['list'] ?? []; if ($respTotal > 0) { $items = collect($respList); - $items->each(fn($item) => Testdrive::syncFromAliPromote($item, $promote_page_id)); + $items->each(fn ($item) => Testdrive::syncFromAliPromote($item, $promote_page_id)); $this->info('===== 同步完成, 共 ' . $items->count() . ' 条数据'); info('===== 同步完成, 共 ' . $items->count() . ' 条数据'); } @@ -83,7 +83,7 @@ public function download($promote_page_id) if ($result->code === '10000') { $body = json_decode($result->httpBody, true); $items = collect($body['alipay_data_dataservice_ad_promotepage_download_response']['list']); - $items->each(fn($item) => Testdrive::syncFromAliPromote($item, $promote_page_id)); + $items->each(fn ($item) => Testdrive::syncFromAliPromote($item, $promote_page_id)); $this->info('===== 同步完成, 共 ' . $items->count() . ' 条数据'); info('===== 同步完成, 共 ' . $items->count() . ' 条数据'); } diff --git a/packages/bydauto/src/Commands/BYDAutoCommand.php b/packages/bydauto/src/Commands/BYDAutoCommand.php index b76620f..efb5588 100644 --- a/packages/bydauto/src/Commands/BYDAutoCommand.php +++ b/packages/bydauto/src/Commands/BYDAutoCommand.php @@ -3,13 +3,11 @@ namespace BYDAuto\Commands; use App\Mail\HelloMail; -use App\Notifications\HelloNotification; use BYDAuto\Models\Activity; use BYDAuto\Models\Contact; use BYDAuto\Models\Testdrive; use BYDAuto\Notifications\TestdirveNotification; use Illuminate\Console\Command; -use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Support\Facades\Mail; class BYDAutoCommand extends Command @@ -61,14 +59,20 @@ public function action_push2contact() $count = $contacts->count(); $offset = cache()->get('push2contact:offset', 0); foreach ($items as $item) { + if (mb_strlen($item->name) > 6) { + info("试驾数据 {$item->id} 姓名异常 {$item->name}"); + $this->info("试驾数据 {$item->id} 姓名异常 {$item->name}"); + $item->update(['status' => Testdrive::STATUS_REJECTED]); + continue; + } $contact = $contacts[$offset]; // $contact->notify(new TestdirveNotification($item)); $item->update(['status' => Testdrive::STATUS_PUBLISHED]); Activity::create([ - 'name' => '试驾通知(测试)', + 'name' => '试驾通知', 'content' => ['testdrive' => $item->id, 'contact' => $contact->id], 'related_id' => $contact->id, - 'related_type' => Contact::class + 'related_type' => Contact::class, ]); info("分配试驾数据 {$item->id} 给联系人 {$contact->id}"); diff --git a/packages/bydauto/src/Models/PromotePage.php b/packages/bydauto/src/Models/PromotePage.php index 3f4eb17..932eebd 100644 --- a/packages/bydauto/src/Models/PromotePage.php +++ b/packages/bydauto/src/Models/PromotePage.php @@ -19,6 +19,8 @@ class PromotePage extends Model { public $timestamps = false; + protected $table = 'bydauto_promote_page'; + protected $fillable = ['id', 'page_id', 'name', 'type', 'property_list']; } diff --git a/packages/bydauto/src/Models/Testdrive.php b/packages/bydauto/src/Models/Testdrive.php index 0e42c2d..1ce2a33 100644 --- a/packages/bydauto/src/Models/Testdrive.php +++ b/packages/bydauto/src/Models/Testdrive.php @@ -25,6 +25,8 @@ class Testdrive extends Model public const STATUS_ARCHIVED = 'archived'; + public const STATUS_REJECTED = 'rejected'; + public const CREATED_AT = 'date_created'; public const UPDATED_AT = 'date_updated'; @@ -120,7 +122,6 @@ public static function cluepackage($data) return $model; } - public static function syncFromAliPromote($data, $pageId) { // {