fix: 修正推荐码验证API响应解析

- referral-service返回 {valid:bool} 格式
- 移除对 data 字段的依赖

🤖 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-21 17:13:18 -08:00
parent 84d15093f0
commit f98f7b2d39
1 changed files with 3 additions and 8 deletions

View File

@ -1426,20 +1426,15 @@ class AccountService {
debugPrint('$_tag verifyReferralCode() - API 响应: ${response.data}');
//
// referral-service {"valid": true/false}
final responseData = response.data as Map<String, dynamic>?;
if (responseData == null) {
debugPrint('$_tag verifyReferralCode() - 响应数据为 null');
throw ApiException('推荐码不存在或无效');
}
final data = responseData['data'];
if (data == null) {
debugPrint('$_tag verifyReferralCode() - data 字段为 null');
throw ApiException('推荐码不存在或无效');
}
debugPrint('$_tag verifyReferralCode() - 推荐码有效');
return data as Map<String, dynamic>;
debugPrint('$_tag verifyReferralCode() - 推荐码验证完成');
return responseData;
} on ApiException catch (e) {
debugPrint('$_tag verifyReferralCode() - API 异常: $e');
rethrow;