Add (serp ai gen)
Add (scheduler)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Helpers\FirstParty\OSSUploader\OSSUploader;
|
||||
use App\Helpers\ThirdParty\DFS\SettingSerpLiveAdvanced;
|
||||
use App\Jobs\PublishIndexPostJob;
|
||||
use App\Models\NewsSerpResult;
|
||||
use DFSClientV3\DFSClient;
|
||||
use Exception;
|
||||
@@ -239,6 +240,8 @@ public static function handle($post)
|
||||
$post->status = 'publish';
|
||||
$post->save();
|
||||
|
||||
PublishIndexPostJob::dispatch($post)->onQueue('default')->onConnection('default');
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Jobs\Tasks;
|
||||
|
||||
use App\Helpers\FirstParty\OpenAI\OpenAI;
|
||||
use App\Jobs\GenerateArticleFeaturedImageJob;
|
||||
use App\Models\Author;
|
||||
use App\Models\Post;
|
||||
use App\Models\PostCategory;
|
||||
@@ -71,6 +72,8 @@ public static function handle(SerpUrl $serp_url)
|
||||
$post_category->category_id = $serp_url->category->id;
|
||||
|
||||
if ($post_category->save()) {
|
||||
GenerateArticleFeaturedImageJob::dispatch($post)->onQueue('default')->onConnection('default');
|
||||
|
||||
return self::saveAndReturnSerpProcessStatus($serp_url, 1);
|
||||
} else {
|
||||
return self::saveAndReturnSerpProcessStatus($serp_url, -5);
|
||||
|
||||
34
app/Jobs/Tasks/PublishIndexPostTask.php
Normal file
34
app/Jobs/Tasks/PublishIndexPostTask.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Tasks;
|
||||
|
||||
use App\Models\Post;
|
||||
use Exception;
|
||||
use IndexNow;
|
||||
use LaravelGoogleIndexing;
|
||||
|
||||
class PublishIndexPostTask
|
||||
{
|
||||
public static function handle(Post $post)
|
||||
{
|
||||
$post->published_at = now();
|
||||
|
||||
if ($post->save()) {
|
||||
if (app()->environment() == 'production') {
|
||||
$post_url = route('front.post', ['slug' => $post->slug]);
|
||||
|
||||
try {
|
||||
IndexNow::submit($post_url);
|
||||
} catch (Exception) {
|
||||
}
|
||||
|
||||
try {
|
||||
LaravelGoogleIndexing::create()->update($post_url);
|
||||
} catch (Exception) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user