debug: 添加流水明细 allocationType 调试日志

- 后端 wallet-service: getMyLedger 打印 payloadJson 和 allocationType
- 前端 wallet_service: 打印原始和解析后的流水数据
- 前端 ledger_detail_page: 打印加载的流水数据详情

用于排查权益类型(社区、省市团队/区域)不显示的问题

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-26 04:35:46 -08:00
parent 3d42c3602d
commit 3f3309e62f
3 changed files with 41 additions and 1 deletions

View File

@ -1721,6 +1721,18 @@ export class WalletApplicationService {
}, },
); );
// 调试日志打印流水数据只打印前5条
this.logger.debug(`[getMyLedger] ======== 流水数据调试 ========`);
this.logger.debug(`[getMyLedger] userId: ${userId}, 共 ${result.data.length} 条, 总计 ${result.total}`);
for (let i = 0; i < result.data.length && i < 5; i++) {
const entry = result.data[i];
const allocationType = (entry.payloadJson as Record<string, unknown>)?.allocationType;
this.logger.debug(
`[getMyLedger] [${i}] entryType=${entry.entryType}, payloadJson=${JSON.stringify(entry.payloadJson)}, allocationType=${allocationType}, memo=${entry.memo}`,
);
}
this.logger.debug(`[getMyLedger] ================================`);
return { return {
data: result.data.map(entry => ({ data: result.data.map(entry => ({
id: entry.id.toString(), id: entry.id.toString(),

View File

@ -528,8 +528,25 @@ class WalletService {
if (response.statusCode == 200) { if (response.statusCode == 200) {
final responseData = response.data as Map<String, dynamic>; final responseData = response.data as Map<String, dynamic>;
final data = responseData['data'] as Map<String, dynamic>? ?? responseData; final data = responseData['data'] as Map<String, dynamic>? ?? responseData;
//
debugPrint('[WalletService] ======== 原始流水数据 ========');
final dataList = data['data'] as List<dynamic>? ?? [];
for (int i = 0; i < dataList.length && i < 5; i++) {
final entry = dataList[i] as Map<String, dynamic>;
debugPrint('[WalletService] 流水[$i]: entryType=${entry['entryType']}, allocationType=${entry['allocationType']}, memo=${entry['memo']}');
}
debugPrint('[WalletService] ================================');
final result = PaginatedLedger.fromJson(data); final result = PaginatedLedger.fromJson(data);
debugPrint('[WalletService] 获取成功: ${result.data.length} 条流水, 共 ${result.total}'); debugPrint('[WalletService] 获取成功: ${result.data.length} 条流水, 共 ${result.total}');
//
debugPrint('[WalletService] ======== 解析后流水数据 ========');
for (int i = 0; i < result.data.length && i < 5; i++) {
final entry = result.data[i];
debugPrint('[WalletService] 流水[$i]: entryType=${entry.entryType}, allocationType=${entry.allocationType}, displayName=${entry.displayName}');
}
debugPrint('[WalletService] ================================'); debugPrint('[WalletService] ================================');
return result; return result;
} }

View File

@ -85,10 +85,21 @@ class _LedgerDetailPageState extends ConsumerState<LedgerDetailPage>
]); ]);
if (mounted) { if (mounted) {
final ledgerData = results[2] as PaginatedLedger;
//
debugPrint('[LedgerDetailPage] ======== 加载流水数据 ========');
debugPrint('[LedgerDetailPage] 共 ${ledgerData.data.length} 条, 总计 ${ledgerData.total}');
for (int i = 0; i < ledgerData.data.length && i < 10; i++) {
final entry = ledgerData.data[i];
debugPrint('[LedgerDetailPage] [$i] entryType=${entry.entryType}, allocationType=${entry.allocationType}, displayName=${entry.displayName}, memo=${entry.memo}');
}
debugPrint('[LedgerDetailPage] ================================');
setState(() { setState(() {
_statistics = results[0] as LedgerStatistics; _statistics = results[0] as LedgerStatistics;
_trend = results[1] as LedgerTrend; _trend = results[1] as LedgerTrend;
_ledger = results[2] as PaginatedLedger; _ledger = ledgerData;
_isLoading = false; _isLoading = false;
}); });
} }