44 lines
946 B
PHP
44 lines
946 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Jobs;
|
||
|
|
|
||
|
|
use App\Utils\Http;
|
||
|
|
use Illuminate\Bus\Queueable;
|
||
|
|
use Illuminate\Queue\SerializesModels;
|
||
|
|
use Illuminate\Queue\InteractsWithQueue;
|
||
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||
|
|
|
||
|
|
class SyncTask implements ShouldQueue
|
||
|
|
{
|
||
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||
|
|
|
||
|
|
public $tries = 3;
|
||
|
|
protected $data;
|
||
|
|
/**
|
||
|
|
* Create a new job instance.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function __construct($data)
|
||
|
|
{
|
||
|
|
$this->data = $data;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Execute the job.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function handle()
|
||
|
|
{
|
||
|
|
$token = env("APP_TASK_TOKEN");
|
||
|
|
$url = env('APP_TASK_URL')."/api/tp/tasks";
|
||
|
|
$header = [
|
||
|
|
'APPTOKEN' => $token,
|
||
|
|
'Content-Type' => 'application/json'
|
||
|
|
];
|
||
|
|
$response = Http::httpV2($url,$this->data, 'POST', $header);
|
||
|
|
}
|
||
|
|
}
|