Add (ai gen)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Jobs\ShopeeSellerTopProductScraperJob;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
@@ -10,9 +12,31 @@ class Kernel extends ConsoleKernel
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('sitemap:generate')->hourly()->runInBackground();
|
||||
// Schdule MY TECH Category
|
||||
$category = Category::where('country_locale_slug','my')->where('name','Technology')->first();
|
||||
|
||||
if (!is_null($category))
|
||||
{
|
||||
$hour = rand(0, 23);
|
||||
$minute = rand(0, 59);
|
||||
|
||||
$schedule->call(function () use ($category) {
|
||||
|
||||
$shopee_seller_category = \App\Models\ShopeeSellerCategory::where('category_id', $category->id)->where(function($query) {
|
||||
$query->whereNull('last_ai_written_at')
|
||||
->orWhere('last_ai_written_at', '=', \App\Models\ShopeeSellerCategory::whereNotNull('last_ai_written_at')->orderBy('last_ai_written_at', 'asc')->value('last_ai_written_at'));
|
||||
})->first();
|
||||
|
||||
$task = ShopeeSellerTopProductScraperJob::dispatch($shopee_seller_category->seller, $category->country_locale->country_iso, $category)
|
||||
->onQueue('default')
|
||||
->onConnection('default');
|
||||
|
||||
|
||||
})->dailyAt("{$hour}:{$minute}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,4 +48,6 @@ protected function commands(): void
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user