migrated()) { // 定时任务在迁移前也会触发;未迁移时没有可补录的范围,跳过而不是每次报错。 $this->info('三方抽成迁移尚未执行,跳过补录'); return self::SUCCESS; } $exit = $lock->run('third-game:backfill-commission', function () use ($service) { // 历史订单(上线前)按上线费率快照补录;定时任务也会执行,直到历史订单补完,部署后无需手动运行。 $exit = self::SUCCESS; try { $history = $service->backfill(false); $this->info(sprintf('历史订单:已补录 %d 笔,仍缺费率 %d 笔', $history['updated'], $history['remaining'])); } catch (\RuntimeException $e) { $this->error('历史订单:' . $e->getMessage()); $exit = self::FAILURE; } if ($this->option('retry-missing')) { $result = $service->backfill(true); $this->info(sprintf('上线后订单:已补录 %d 笔,仍缺费率 %d 笔', $result['updated'], $result['remaining'])); } return $exit; }); if ($exit === null) { $this->info('三方抽成补录正在运行'); } return $exit ?? self::SUCCESS; } }