Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 4412ac66
authored
2026-07-11 14:16:40 +0800
by
ethanlamzs
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化提示
1 parent
c281ea4f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
5 deletions
lib/data/repositories/user_auth_repository.dart
lib/services/subscription_service_ios.dart
lib/data/repositories/user_auth_repository.dart
View file @
4412ac6
...
...
@@ -165,8 +165,6 @@ class UserAuthRepository {
// 检查ios的订单是否已经订阅
Future
<
dynamic
>
orderCheck
(
String
userId
,
String
receipt
,
String
orderid
,
String
platform
,
int
isSandbox
)
async
{
try
{
debugPrint
(
'收据长度:
${receipt.length}
'
);
debugPrint
(
'收据前100字符:
${receipt.substring(0, receipt.length > 100 ? 100 : receipt.length)}
'
);
Response
resp
=
await
_appService
.
post
(
'/api/v1/comm/user/ordercheck'
,
{
...
...
lib/services/subscription_service_ios.dart
View file @
4412ac6
...
...
@@ -67,7 +67,7 @@ class SubscriptionService {
}
_products
=
response
.
productDetails
;
debugPrint
(
'获取到
${_products.length}
个产品'
);
//
debugPrint('获取到 ${_products.length} 个产品');
// for (var p in _products) {
// debugPrint('x1=====> 产品ID: ${p.id}, 标题: ${p.title}, 价格: ${p.price}');
// }
...
...
@@ -139,6 +139,7 @@ class SubscriptionService {
// ✅ 关键:只要不是 pending,都立刻完成交易,清出队列
if
(
purchaseDetails
.
status
!=
PurchaseStatus
.
pending
)
{
_iap
.
completePurchase
(
purchaseDetails
);
print
(
"[debug] _iap.completePurchase execute "
);
}
}
}
...
...
@@ -153,13 +154,11 @@ class SubscriptionService {
// 把 base64Receipt 作为 receipt-data 发给你的服务端验证
final
bool
isValid
=
await
_sendReceiptToBackend
(
receipt
,
orderid
);
debugPrint
(
"[info] _verifyReceipt is step 1 "
);
if
(
isValid
)
{
// 更新本地订阅状态
_hasActiveSubscription
=
true
;
// 保存到期时间等信息
}
debugPrint
(
"[info] _verifyReceipt is done "
);
}
// 示例:发送收据到自己的服务器进行二次验证
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment