Add (news bites)
This commit is contained in:
42
app/Jobs/BrowseDFSAndWriteWithAIJob.php
Normal file
42
app/Jobs/BrowseDFSAndWriteWithAIJob.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Jobs\Tasks\BrowseDFSLatestNewsTask;
|
||||
use App\Jobs\Tasks\ParseDFSNewsTask;
|
||||
use Exception;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class BrowseDFSAndWriteWithAIJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $timeout = 20;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$news_serp_result = BrowseDFSLatestNewsTask::handle('ai', 'US');
|
||||
|
||||
if (! is_null($news_serp_result)) {
|
||||
ParseDFSNewsTask::handle($news_serp_result);
|
||||
} else {
|
||||
throw new Exception('Empty news_serp_result. API error?');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user