option('full')) { return self::SUCCESS; } try { $result = $synchronizer ->forConfigKey('ding_online_daifa_price') ->sync( (bool) $this->option('full'), $this->option('batch') === null ? null : (int) $this->option('batch'), $this->option('max-batches') === null ? null : (int) $this->option('max-batches'), ); } catch (Throwable $exception) { Log::error('钉钉线上代发价格流程镜像同步失败。', ['exception' => $exception::class]); $this->error('钉钉线上代发价格流程同步失败,已保留上一版共享数据。'); return self::FAILURE; } $this->info(sprintf( '%s:本轮 %d 批,累计处理 %d 条明细。', $result['status'] === 'succeeded' ? '同步完成' : '同步进行中', $result['batches'], $result['rows'], )); // 同步完成后预先算好成本核查结果,页面打开时直接读缓存。 if ($result['status'] === 'succeeded') { try { $this->info(sprintf('成本核查已预计算:%d 行。', app(DingOnlineDaifaPriceMirrorRepository::class)->warmAuditCache())); } catch (Throwable $exception) { report($exception); $this->warn('成本核查预计算失败,页面打开时会重新计算。'); } } return self::SUCCESS; } }