feat(mobile): 预种明细显示来源用户ID + 修复空待领取倒计时

1. 预种待领取/可结算明细的 memo 中追加来源用户(如"来自D26022600016的预种")
2. 修复 pendingUsdt=0 时倒计时仍然显示的问题(pending_expire_at 未清除时兜底)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-01 09:48:34 -08:00
parent b13d873f64
commit 8e52535dd9
2 changed files with 32 additions and 6 deletions

View File

@ -87,8 +87,10 @@ class RewardsInfo {
}
///
/// [2026-03-01] pendingUsdt=0 0
int get pendingRemainingSeconds {
if (pendingExpireAt == null) return 0;
if (pendingUsdt <= 0) return 0;
final remaining = pendingExpireAt!.difference(DateTime.now()).inSeconds;
return remaining > 0 ? remaining : 0;
}

View File

@ -814,7 +814,12 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
final excludedPplOrderIds = {...pendingPplOrderIds, ...expiredPplOrderIds};
final prePlantingSettleable = prePlantingRewards.settleableRewards
.where((r) => !excludedPplOrderIds.contains(r.sourceOrderNo))
.map((r) => SettleableRewardItem(
.map((r) {
final srcAcct = r.sourceAccountSequence;
final memoSuffix = (srcAcct != null && srcAcct.isNotEmpty)
? ':来自${srcAcct}的预种'
: '';
return SettleableRewardItem(
id: r.id,
rightType: r.rightType,
usdtAmount: r.usdtAmount,
@ -823,8 +828,9 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
claimedAt: null,
sourceOrderNo: r.sourceOrderNo,
sourceAccountSequence: r.sourceAccountSequence,
memo: '[预种] ${r.memo}',
))
memo: '[预种] ${r.memo}$memoSuffix',
);
})
.toList();
settleableRewards = [...settleableRewards, ...prePlantingSettleable];
debugPrint('[ProfilePage] 预种可结算奖励: ${prePlantingSettleable.length} 条 (排除 ${pendingPplOrderIds.length} 条 PENDING, ${expiredPplOrderIds.length} 条 EXPIRED)');
@ -833,9 +839,25 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
// wallet-service pending_rewards +
// reward-service /rewards/pending
// sourceOrderId PPL
//
// [2026-03-01] sourceOrderNo sourceAccountSequence
// IDwallet pending_rewards
// pre-planting/my-rewards
final pplSourceAccountMap = <String, String>{};
for (final r in prePlantingRewards.settleableRewards) {
if (r.sourceAccountSequence != null && r.sourceAccountSequence!.isNotEmpty) {
pplSourceAccountMap[r.sourceOrderNo] = r.sourceAccountSequence!;
}
}
final prePlantingPending = walletPendingRewards
.where((r) => r.isPrePlanting)
.map((r) => PendingRewardItem(
.map((r) {
final sourceAccount = pplSourceAccountMap[r.sourceOrderId];
final typeName = getAllocationTypeName(r.allocationType);
final memo = sourceAccount != null
? '[预种] $typeName:来自${sourceAccount}的预种'
: '[预种] $typeName';
return PendingRewardItem(
id: 'wp-${r.id}',
rightType: r.allocationType,
usdtAmount: r.usdtAmount,
@ -844,8 +866,10 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
expireAt: r.expireAt,
remainingTimeMs: r.expireAt.difference(DateTime.now()).inMilliseconds.clamp(0, 86400000),
sourceOrderNo: r.sourceOrderId,
memo: '[预种] ${getAllocationTypeName(r.allocationType)}',
))
sourceAccountSequence: sourceAccount,
memo: memo,
);
})
.toList();
final mergedPendingRewards = [...pendingRewards, ...prePlantingPending];
debugPrint('[ProfilePage] 预种待领取奖励: ${prePlantingPending.length}');