diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 04ad124c..9d01293a 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -28,7 +28,7 @@ class Kernel extends ConsoleKernel $logPath = storage_path('logs/artisan.log'); $schedule->command('real:sync-activated')->cron('* */4 * * *')->withoutOverlapping()->appendOutputTo($logPath); $schedule->command('virtual:schedule-auto-activate')->cron('* * * 1 *')->withoutOverlapping()->appendOutputTo($logPath); - $schedule->command('virtual:schedule-vd-activate')->cron('0 2 * * *')->withoutOverlapping()->appendOutputTo($logPath); + // $schedule->command('virtual:schedule-vd-activate')->cron('0 2 * * *')->withoutOverlapping()->appendOutputTo($logPath); } /** diff --git a/app/Domains/Real/Commands/Sync/ActivatedSync.php b/app/Domains/Real/Commands/Sync/ActivatedSync.php index eaa2e4db..4221e541 100644 --- a/app/Domains/Real/Commands/Sync/ActivatedSync.php +++ b/app/Domains/Real/Commands/Sync/ActivatedSync.php @@ -7,6 +7,7 @@ use App\Models\Card\Card; use App\Models\Mongo\TblCard; use MongoDB\BSON\UTCDateTime; use Illuminate\Support\Facades\DB; +use Symfony\Component\Console\Input\InputOption; use App\Domains\Card\Repositories\CardRepository; use Symfony\Component\Console\Input\InputArgument; use App\Domains\Virtual\Repositories\OrderCardPartitionRepository; @@ -22,8 +23,12 @@ class ActivatedSync extends Command public function handle() { $day = $this->getDay(); - $startMicrotime = new UTCDateTime($day->startOfDay()); - $endMicrotime = new UTCDateTime($day->endOfDay()); + $startMicrotime = new UTCDateTime($day->copy()->startOfDay()); + $endMicrotime = new UTCDateTime($day->copy()->endOfDay()); + + if ($this->option('month')) { + $startMicrotime = new UTCDateTime($day->copy()->subMonth()->startOfMonth()); + } $query = TblCard::where('pNo', 'No00000000768')->where('isDel', 0) ->where('saDate', 'exists', true) @@ -93,6 +98,13 @@ class ActivatedSync extends Command return Carbon::yesterday()->startOfDay(); } + protected function getOptions() + { + return [ + ['--month', null, InputOption::VALUE_NONE, '首次同步按月同步'], + ]; + } + protected function getArguments() { return [