|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Console;
|
|
namespace App\Console;
|
|
|
|
|
|
|
|
+use App\Models\CheckCard;
|
|
use Carbon\Carbon;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
@@ -30,6 +31,16 @@ class Kernel extends ConsoleKernel
|
|
$schedule->call(function () {
|
|
$schedule->call(function () {
|
|
$begin = Carbon::today()->toDateTimeString();
|
|
$begin = Carbon::today()->toDateTimeString();
|
|
$end = Carbon::tomorrow()->toDateTimeString();
|
|
$end = Carbon::tomorrow()->toDateTimeString();
|
|
|
|
+
|
|
|
|
+ $items = CheckCard::where([
|
|
|
|
+ ['begin_date_time', '>=', $begin],
|
|
|
|
+ ['begin_date_time', '<', $end],
|
|
|
|
+ ])->whereNull('end_date_time')->get();
|
|
|
|
+
|
|
|
|
+ foreach($items as $item) {
|
|
|
|
+ $item->end_date_time = Carbon::createFromTimestamp(strtotime($item->begin_date_time))->addHours(2)->toDateTimeString();
|
|
|
|
+ $item->save();
|
|
|
|
+ }
|
|
})->dailyAt('23:50');
|
|
})->dailyAt('23:50');
|
|
}
|
|
}
|
|
|
|
|