Add (ai gen)
This commit is contained in:
@@ -30,9 +30,9 @@ protected function schedule(Schedule $schedule)
|
|||||||
|
|
||||||
if (!is_null($nextRun))
|
if (!is_null($nextRun))
|
||||||
{
|
{
|
||||||
$currentTime = now()->format('H:i:00');
|
$currentTime = now();
|
||||||
|
|
||||||
if ($currentTime == $nextRun->next_run_time) {
|
if ($currentTime->equalTo($nextRun->next_run_time)) {
|
||||||
|
|
||||||
$shopee_seller_category = ShopeeSellerCategory::where('category_id', $category->id)->where(function($query) {
|
$shopee_seller_category = ShopeeSellerCategory::where('category_id', $category->id)->where(function($query) {
|
||||||
$query->whereNull('last_ai_written_at')
|
$query->whereNull('last_ai_written_at')
|
||||||
@@ -44,7 +44,7 @@ protected function schedule(Schedule $schedule)
|
|||||||
->onConnection('default');
|
->onConnection('default');
|
||||||
|
|
||||||
// Update the next random run time for the following day using Eloquent
|
// Update the next random run time for the following day using Eloquent
|
||||||
$nextRun->next_run_time = now()->addMinutes(rand(1200, 1440))->format('H:i:00');
|
$nextRun->next_run_time = now()->addMinutes(rand(1200, 1440));
|
||||||
$nextRun->save();
|
$nextRun->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ protected function schedule(Schedule $schedule)
|
|||||||
{
|
{
|
||||||
$nextRun = new DailyTaskSchedule;
|
$nextRun = new DailyTaskSchedule;
|
||||||
$nextRun->task = 'my-technology';
|
$nextRun->task = 'my-technology';
|
||||||
$nextRun->next_run_time = now()->addMinutes(rand(0, 1440))->format('H:i:00');
|
$nextRun->next_run_time = now()->addMinutes(rand(0, 1440));
|
||||||
$nextRun->save();
|
$nextRun->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public function up(): void
|
|||||||
Schema::create('daily_task_schedules', function (Blueprint $table) {
|
Schema::create('daily_task_schedules', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('task');
|
$table->string('task');
|
||||||
$table->time('next_run_time');
|
$table->timestamp('next_run_time');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user