love_php/app/Jobs/AdQuickBackActivation.php

50 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2026-04-02 09:20:51 +08:00
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class AdQuickBackActivation implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $quick_back_log;
protected $event_type;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($arr)
{
$this->event_type = $arr['event_type'];
$this->quick_back_log = $arr['quick_back_log'];
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$quick_back_log = $this->quick_back_log;
$event_type = $this->event_type;
$client = new \GuzzleHttp\Client();
//快手激活回调
if ($quick_back_log) {
$url = $quick_back_log->callback.'&event_type='.$event_type."&event_time=".time();
$ClientInfo = $client->request('GET', $url);
$arr = json_decode($ClientInfo->getBody()->getContents(), true);
if (is_array($arr) && $arr['result']) {
$quick_back_log->status = 1;
$quick_back_log->save();
}
}
}
}