From d27f327f9cb3841faeb8344b223444caa06acbfd Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 13 Feb 2026 22:57:41 -0800 Subject: [PATCH] =?UTF-8?q?fix(mining-app):=20=E8=B5=84=E4=BA=A7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=95=B0=E6=8D=AE=E4=B8=80=E8=87=B4=E6=80=A7=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=B8=8E=E5=86=97=E4=BD=99=E4=BC=B0=E5=80=BC=E9=9A=90?= =?UTF-8?q?=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题: 1. 总资产估值(顶部)使用 WebSocket 实时推送的价格和销毁倍数计算, 而积分股列表项中的"≈ xxx 积分值"使用 API 返回的静态值计算, 导致两处显示的积分值不一致(因自动销毁每分钟改变价格参数)。 2. 修复数据源统一后,积分股下方的"≈ xxx 积分值"与顶部总资产估值 完全相同,显示冗余。 修改: - _buildAssetList 中的 multiplier 和 currentPrice 改为优先使用 WebSocket 实时值(_currentBurnMultiplier / _currentPrice), API 值仅作为 fallback,确保与 _calculateTotalAssetValue 一致 - 暂时隐藏积分股条目下方的"≈ xxx 积分值"显示(注释保留,便于恢复) Co-Authored-By: Claude Opus 4.6 --- .../lib/presentation/pages/asset/asset_page.dart | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart b/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart index bfa5b2fb..90128e49 100644 --- a/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart +++ b/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart @@ -497,9 +497,12 @@ class _AssetPageState extends ConsumerState { final shareBalance = asset != null && currentShareBalance > 0 ? currentShareBalance : double.tryParse(asset?.shareBalance ?? '0') ?? 0; - final multiplier = double.tryParse(asset?.burnMultiplier ?? '0') ?? 0; + // 优先使用 WebSocket 实时值,与总资产估值保持一致 + final multiplier = double.tryParse( + _currentBurnMultiplier != '0' ? _currentBurnMultiplier : (asset?.burnMultiplier ?? '0')) ?? 0; final multipliedAsset = shareBalance * multiplier; - final currentPrice = double.tryParse(asset?.currentPrice ?? '0') ?? 0; + final currentPrice = double.tryParse( + _currentPrice != '0' ? _currentPrice : (asset?.currentPrice ?? '0')) ?? 0; final isDark = AppColors.isDark(context); // 根据订单状态动态计算冻结原因 @@ -517,9 +520,9 @@ class _AssetPageState extends ConsumerState { title: '积分股', amount: asset != null ? shareBalance.toString() : null, isLoading: isLoading, - valueInCny: asset != null - ? '${formatAmount((shareBalance * (1 + multiplier) * currentPrice).toString())} 积分值' - : null, + // valueInCny: asset != null + // ? '${formatAmount((shareBalance * (1 + multiplier) * currentPrice).toString())} 积分值' + // : null, // 暂时隐藏:与总资产估值使用相同数据源后,此处显示冗余 // tag: asset != null ? '含倍数资产: ${formatCompact(multipliedAsset.toString())}' : null, // 暂时隐藏 growthText: asset != null ? '每秒 +${formatDecimal(perSecondEarning, 8)}' : null, ),