get(self::CURSOR_KEY) ?: 946656000000; $nextMicrotime = intval(microtime(true) * 1000); $utcDateTime = new UTCDateTime($microtime); $total = TblCard::where('pNo', 'No00000000768')->where('oRDate', '>', $utcDateTime)->where('sDate', 'exists', true)->count(); $this->line('待同步条数:'.$total); if ($total) { Artisan::call('real:sync-bloc'); } $page = 1; $jobs = new Collection(); while ($total) { $page++; if ($page * $this->limit >= $total) { break; } $jobs->push(new MongoSyncJob($page, $this->limit, $utcDateTime)); } app(ConfigService::class)->set(self::CURSOR_KEY, intval($nextMicrotime)); $total && MongoSyncJob::withChain($jobs->toArray()) ->dispatch(1, $this->limit, $utcDateTime) ->allOnQueue('sync'); } }