option('days') ?: 0); $from = $this->option('from') ?: null; $merge = (bool) $this->option('merge'); if ($days > 0) { $from = now()->subDays(max(1, $days) - 1)->toDateString(); $merge = true; } try { $result = $synchronizer->sync( ! $this->option('no-recalculate'), $from, $this->option('to') ?: null, $merge, ); } catch (Throwable $exception) { $this->error($exception->getMessage()); return self::FAILURE; } $this->table(['项目', '值'], [ ['明细行数', $result['rows']], ['收入合计', number_format($result['income'], 2)], ['支出合计', number_format($result['expense'], 2)], ['日期范围', $result['from'] . ' ~ ' . $result['to']], ['每日流水行数', $result['recalculated']['flows'] ?? '-'], ['期末余额合计', isset($result['recalculated']) ? number_format($result['recalculated']['balance_sum'], 2) : '-'], ]); $this->line('来源分布:'); foreach (($result['source_counts'] ?? []) as $source => $count) { $this->line(' ' . $source . ': ' . $count); } $this->info('财务台账 rpt 同步完成。'); return self::SUCCESS; } }