love_php/app/Jobs/SyncTask.php

44 lines
946 B
PHP
Raw Normal View History

2026-04-02 09:20:51 +08:00
<?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);
}
}