fix(mobile): fix wallet API response parsing

The wallet API returns wrapped format { success, data, timestamp }
but the parser was reading from the root object directly.
Now correctly unpacks the inner 'data' field before parsing.

🤖 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-10 06:55:30 -08:00
parent 22c32031af
commit 76377c3bb6
1 changed files with 7 additions and 2 deletions

View File

@ -160,8 +160,13 @@ class WalletService {
debugPrint('[WalletService] 响应数据类型: ${response.data.runtimeType}');
if (response.statusCode == 200) {
final data = response.data as Map<String, dynamic>;
debugPrint('[WalletService] 原始响应数据: $data');
final responseData = response.data as Map<String, dynamic>;
debugPrint('[WalletService] 原始响应数据: $responseData');
// API : { success: true, data: {...}, timestamp: "..." }
// data
final data = responseData['data'] as Map<String, dynamic>? ?? responseData;
debugPrint('[WalletService] 解包后数据: $data');
//
final wallet = WalletResponse.fromJson(data);