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:
parent
84d15093f0
commit
f98f7b2d39
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue