feat: 实现 iOS Apple Pay 内购支付功能

前端:
- 集成 in_app_purchase 插件,实现 IAP 支付流程
- 添加支付模块 (payments/) 处理产品获取、购买、验证
- 积分中心页面集成 Apple Pay 购买入口
- 设置页面重构: 关于/隐私/协议直接展示,删除 legal_center 子页面
- 修复欢迎引导页滚动检测阈值问题
- 修复解卦结果页 iOS 侧滑返回手势被阻止的问题
- 邀请码绑定按钮临时禁用(待后端实现)

后端:
- 新增 apple_iap_transactions 表记录交易
- 实现 Apple 服务器端验证 (App Store Server API)
- 支付成功后自动发放积分
- 支持 Sandbox/Production 环境切换
- 添加退款处理和交易状态机

协议:
- 更新积分流水协议,支持 purchase/refund 类型
- 新增 PAYMENT_* 错误码
This commit is contained in:
ZL-Q
2026-04-28 10:45:29 +08:00
parent b453ff7345
commit 87f92987b2
58 changed files with 3741 additions and 336 deletions
+7 -1
View File
@@ -505,5 +505,11 @@
"feedbackContentRequired": "Please enter feedback content",
"feedbackContentTooLong": "Feedback content cannot exceed 500 characters",
"feedbackTooManyImages": "Maximum 3 images allowed",
"feedbackImageTooLarge": "Image size cannot exceed 5MB"
"feedbackImageTooLarge": "Image size cannot exceed 5MB",
"paymentSuccess": "Purchase successful",
"paymentVerifyFailed": "Purchase verification failed, please try again later",
"paymentProductNotFound": "Product temporarily unavailable",
"paymentStarterPackIneligible": "Starter pack is limited to one purchase per user",
"paymentProductUnavailable": "Product temporarily unavailable",
"paymentPending": "Apple is processing, please wait"
}
+36
View File
@@ -2432,6 +2432,42 @@ abstract class AppLocalizations {
/// In zh, this message translates to:
/// **'图片大小不能超过5MB'**
String get feedbackImageTooLarge;
/// No description provided for @paymentSuccess.
///
/// In zh, this message translates to:
/// **'购买成功'**
String get paymentSuccess;
/// No description provided for @paymentVerifyFailed.
///
/// In zh, this message translates to:
/// **'购买验证失败,请稍后重试'**
String get paymentVerifyFailed;
/// No description provided for @paymentProductNotFound.
///
/// In zh, this message translates to:
/// **'商品暂时不可用'**
String get paymentProductNotFound;
/// No description provided for @paymentStarterPackIneligible.
///
/// In zh, this message translates to:
/// **'新手包每位用户仅限购买一次'**
String get paymentStarterPackIneligible;
/// No description provided for @paymentProductUnavailable.
///
/// In zh, this message translates to:
/// **'商品暂时不可用'**
String get paymentProductUnavailable;
/// No description provided for @paymentPending.
///
/// In zh, this message translates to:
/// **'Apple 正在处理中,请稍候'**
String get paymentPending;
}
class _AppLocalizationsDelegate
+20
View File
@@ -1282,4 +1282,24 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get feedbackImageTooLarge => 'Image size cannot exceed 5MB';
@override
String get paymentSuccess => 'Purchase successful';
@override
String get paymentVerifyFailed =>
'Purchase verification failed, please try again later';
@override
String get paymentProductNotFound => 'Product temporarily unavailable';
@override
String get paymentStarterPackIneligible =>
'Starter pack is limited to one purchase per user';
@override
String get paymentProductUnavailable => 'Product temporarily unavailable';
@override
String get paymentPending => 'Apple is processing, please wait';
}
+36
View File
@@ -1225,6 +1225,24 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get feedbackImageTooLarge => '图片大小不能超过5MB';
@override
String get paymentSuccess => '购买成功';
@override
String get paymentVerifyFailed => '购买验证失败,请稍后重试';
@override
String get paymentProductNotFound => '商品暂时不可用';
@override
String get paymentStarterPackIneligible => '新手包每位用户仅限购买一次';
@override
String get paymentProductUnavailable => '商品暂时不可用';
@override
String get paymentPending => 'Apple 正在处理中,请稍候';
}
/// The translations for Chinese, using the Han script (`zh_Hant`).
@@ -2204,4 +2222,22 @@ class AppLocalizationsZhHant extends AppLocalizationsZh {
@override
String get feedbackImageTooLarge => '圖片大小不能超過5MB';
@override
String get paymentSuccess => '購買成功';
@override
String get paymentVerifyFailed => '購買驗證失敗,請稍後重試';
@override
String get paymentProductNotFound => '商品暫時不可用';
@override
String get paymentStarterPackIneligible => '新手包每位用戶僅限購買一次';
@override
String get paymentProductUnavailable => '商品暫時不可用';
@override
String get paymentPending => 'Apple 正在處理中,請稍候';
}
+7 -1
View File
@@ -505,5 +505,11 @@
"feedbackContentRequired": "请输入反馈内容",
"feedbackContentTooLong": "反馈内容不能超过500字",
"feedbackTooManyImages": "最多只能上传3张图片",
"feedbackImageTooLarge": "图片大小不能超过5MB"
"feedbackImageTooLarge": "图片大小不能超过5MB",
"paymentSuccess": "购买成功",
"paymentVerifyFailed": "购买验证失败,请稍后重试",
"paymentProductNotFound": "商品暂时不可用",
"paymentStarterPackIneligible": "新手包每位用户仅限购买一次",
"paymentProductUnavailable": "商品暂时不可用",
"paymentPending": "Apple 正在处理中,请稍候"
}
+7 -1
View File
@@ -407,5 +407,11 @@
"feedbackContentRequired": "請輸入回饋內容",
"feedbackContentTooLong": "回饋內容不能超過500字",
"feedbackTooManyImages": "最多只能上傳3張圖片",
"feedbackImageTooLarge": "圖片大小不能超過5MB"
"feedbackImageTooLarge": "圖片大小不能超過5MB",
"paymentSuccess": "購買成功",
"paymentVerifyFailed": "購買驗證失敗,請稍後重試",
"paymentProductNotFound": "商品暫時不可用",
"paymentStarterPackIneligible": "新手包每位用戶僅限購買一次",
"paymentProductUnavailable": "商品暫時不可用",
"paymentPending": "Apple 正在處理中,請稍候"
}