option('days') ?: 0); $from = $this->option('from') ?: null; if ($days > 0) { $from = now()->subDays(max(1, $days) - 1)->toDateString(); } try { $result = $synchronizer->sync( $from, $this->option('to') ?: null, ! $this->option('no-recalculate'), (bool) $this->option('rebuild'), ); } catch (Throwable $exception) { $this->error($exception->getMessage()); return self::FAILURE; } $this->table(['项目', '值'], [ ['店铺余额日期', $result['balance']['date'] ?: '-'], ['余额源记录', $result['balance']['source']], ['补充确认店铺', $result['balance']['added']], ['重建店铺台账', $result['balance']['rebuilt']], ['已更新店铺余额', $result['balance']['matched']], ['店铺余额合计', number_format((float) $result['balance']['amount'], 2)], ['提现处理笔数', $result['withdrawals']['processed']], ['提现新增或更新', $result['withdrawals']['written']], ['上游已存在提现', $result['withdrawals']['upstream_duplicates']], ['店铺未匹配', $result['withdrawals']['unmatched']], ['账户缺失', $result['withdrawals']['account_missing']], ['提现收入合计', number_format((float) $result['withdrawals']['income'], 2)], ['提现冲回支出', number_format((float) $result['withdrawals']['expense'], 2)], ['每日流水行数', $result['recalculated']['flows'] ?? '-'], ['PHP 峰值内存', number_format(memory_get_peak_usage(true) / 1048576, 1) . ' MiB'], ]); $this->info('财务台账店铺余额与提现同步完成。'); return self::SUCCESS; } }