get(self::CURSOR_KEY) ?: 0; $query = DB::connection('vd_old')->table('ckb_custom')->where('id', '>', $maxId)->orderBy('id'); $nextId = $query->max('id'); $total = $query->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 CardSyncJob($page, $this->limit, $maxId))->onQueue('sync')); } app(ConfigService::class)->set(self::CURSOR_KEY, $nextId); CardSyncJob::onQueue('sync')->withChain($jobs->toArray())->dispatch(1, $this->limit, $maxId); } }