fix(asset): 总资产估值包含积分值余额

总资产估值 = 积分股价值 + 积分值余额
- 积分股价值 = 积分股 × (1 + burnMultiplier) × 价格
- 积分值余额 = 可用积分值 + 冻结积分值

之前只计算了积分股价值,现在加上了积分值(现金)余额。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-19 04:26:21 -08:00
parent d4f7cd834a
commit d9d46065e0
1 changed files with 20 additions and 10 deletions

View File

@ -117,15 +117,25 @@ class _AssetPageState extends ConsumerState<AssetPage> {
_timerStarted = false;
}
///
/// 使 WebSocket
/// = × (1 + burnMultiplier) × price
double get _currentDisplayValue {
///
/// = +
/// = × (1 + burnMultiplier) × price
/// = +
double _calculateTotalAssetValue(AssetDisplay? asset) {
// 使 WebSocket 使 API
final price = double.tryParse(_currentPrice) ?? 0;
final burnMultiplier = double.tryParse(_currentBurnMultiplier) ?? 0;
final multiplierFactor = 1 + burnMultiplier;
return _currentShareBalance * multiplierFactor * price;
//
final shareValue = _currentShareBalance * multiplierFactor * price;
// = +
final availableCash = double.tryParse(asset?.availableCash ?? '0') ?? 0;
final frozenCash = double.tryParse(asset?.frozenCash ?? '0') ?? 0;
final totalCash = availableCash + frozenCash;
return shareValue + totalCash;
}
///
@ -210,7 +220,7 @@ class _AssetPageState extends ConsumerState<AssetPage> {
children: [
const SizedBox(height: 8),
// -
_buildTotalAssetCard(asset, isLoading, _currentDisplayValue, _currentShareBalance, perSecondEarning),
_buildTotalAssetCard(asset, isLoading, _calculateTotalAssetValue(asset), _currentShareBalance, perSecondEarning),
const SizedBox(height: 24),
//
_buildQuickActions(context),
@ -255,13 +265,13 @@ class _AssetPageState extends ConsumerState<AssetPage> {
);
}
Widget _buildTotalAssetCard(AssetDisplay? asset, bool isLoading, double currentDisplayValue, double currentShareBalance, String perSecondEarning) {
Widget _buildTotalAssetCard(AssetDisplay? asset, bool isLoading, double totalAssetValue, double currentShareBalance, String perSecondEarning) {
// 使 mining-service
final growthPerSecond = double.tryParse(perSecondEarning) ?? 0.0;
// 使
final displayValue = asset != null && currentDisplayValue > 0
? currentDisplayValue.toString()
// 使 +
final displayValue = asset != null && totalAssetValue > 0
? totalAssetValue.toString()
: asset?.displayAssetValue;
// = × (1 + burnMultiplier)