Add (news bites)

This commit is contained in:
2023-11-21 19:18:11 +08:00
parent 2e38a4120c
commit 3210563e42
37 changed files with 1581 additions and 153 deletions

View File

@@ -2,7 +2,8 @@
namespace App\Console;
use App\Jobs\BrowseAndWriteWithAIJob;
use App\Jobs\BrowseDFSAndWriteWithAIJob;
use App\Jobs\BrowseRSSPostJob;
use App\Jobs\PublishIndexPostJob;
use App\Models\Post;
use Illuminate\Console\Scheduling\Schedule;
@@ -15,20 +16,24 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule): void
{
$schedule->command('sitemap:generate')->daily()->name('sitemap-generate-daily');
$schedule->command('sitemap:generate')->everySixHours()->name('sitemap-generate-every-six-hours');
$schedule->call(function () {
BrowseAndWriteWithAIJob::dispatch()->onQueue('default')->onConnection('default');
})->everySixHours()->name('write-a-job-6hrs');
BrowseRSSPostJob::dispatch(1)->onQueue('default')->onConnection('default');
})->hourly()->name('browse-rss-post-job-hourly');
$schedule->call(function () {
$future_post = Post::whereNotNull('published_at')->where('status', 'future')->where('published_at', '<=', now())->orderBy('published_at', 'ASC')->first();
// $schedule->call(function () {
// BrowseDFSAndWriteWithAIJob::dispatch()->onQueue('default')->onConnection('default');
// })->everySixHours()->name('write-a-job-6hrs');
if (! is_null($future_post)) {
PublishIndexPostJob::dispatch($future_post->id)->onQueue('default')->onConnection('default');
}
// $schedule->call(function () {
// $future_post = Post::whereNotNull('published_at')->where('status', 'future')->where('published_at', '<=', now())->orderBy('published_at', 'ASC')->first();
})->everyMinute()->name('schedule-future-post');
// if (! is_null($future_post)) {
// PublishIndexPostJob::dispatch($future_post->id)->onQueue('default')->onConnection('default');
// }
// })->everyMinute()->name('schedule-future-post');
}