Files
productalert/app/Jobs/ShopeeSellerTopProductScraperJob.php
2023-10-01 00:35:27 +08:00

56 lines
1.3 KiB
PHP

<?php
namespace App\Jobs;
use App\Jobs\Tasks\GenerateShopeeAIArticleTask;
use App\Jobs\Tasks\SaveShopeeSellerImagesTask;
use App\Jobs\Tasks\ShopeeSellerTopProductScraperTask;
use App\Models\Category;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ShopeeSellerTopProductScraperJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $timeout = 1000;
protected $seller;
protected $country_iso;
protected $category;
/**
* Create a new job instance.
*/
public function __construct(string $seller, string $country_iso, Category $category)
{
$this->seller = $seller;
$this->country_iso = $country_iso;
$this->category = $category;
}
/**
* Execute the job.
*/
public function handle(): void
{
$shopee_task = ShopeeSellerTopProductScraperTask::handle($this->seller, $this->country_iso, $this->category);
//dd($shopee_task->product_task);
if (! is_null($shopee_task)) {
SaveShopeeSellerImagesTask::handle($shopee_task);
GenerateShopeeAIArticleTask::handle($shopee_task->shopee_seller_scrape);
}
}
}