This commit is contained in:
邓皓元 2019-04-22 16:36:11 +08:00
parent bdff9f28bb
commit a4f3b877ca
2 changed files with 15 additions and 3 deletions

View File

@ -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);
}
/**

View File

@ -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 [