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

This commit is contained in:
珂珂 2024-11-15 16:26:06 +08:00
parent 793e8fda43
commit f2f90f06f7
6 changed files with 19 additions and 20 deletions

View File

@ -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
{

View File

@ -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 [
//
];
}
}

View File

@ -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() . ' 条数据');
}

View File

@ -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}");

View File

@ -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'];
}

View File

@ -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)
{
// {