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:
parent
22c32031af
commit
76377c3bb6
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue