50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
|
|
<?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();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|