feat(iap/apple): 实现苹果IAP非续期订阅功能
Build docker and publish / build (20.15.1) (push) Successful in 6m37s
Build docker and publish / build (20.15.1) (push) Successful in 6m37s
新增苹果IAP相关接口与逻辑,包括产品列表查询、交易绑定、状态查询和恢复购买功能。移除旧的IAP验证逻辑,重构订阅系统以支持苹果IAP交易记录存储和权益计算。 - 新增/pkg/iap/apple包处理JWS解析和产品映射 - 实现GET /products、POST /attach、POST /restore和GET /status接口 - 新增apple_iap_transactions表存储交易记录 - 更新文档说明配置方式和接口规范 - 移除旧的AppleIAP验证和通知处理逻辑
This commit is contained in:
+41
-1
@@ -158,4 +158,44 @@ Administer: # 管理员登录配置
|
||||
- **数据库**:确保 `MySQL` 和 `Redis` 凭据安全,避免在版本控制中暴露。
|
||||
- **JWT**:为 `JwtAuth` 的 `AccessSecret` 设置强密钥以增强安全性。
|
||||
|
||||
如需进一步帮助,请参考 PPanel 官方文档或联系支持团队。
|
||||
如需进一步帮助,请参考 PPanel 官方文档或联系支持团队。
|
||||
|
||||
## 6. Apple IAP(非续期订阅)配置
|
||||
|
||||
- 通过 `Site.CustomData` 配置内购商品与权益映射,示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"iapProductMap": {
|
||||
"com.airport.vpn.pass.30d": {
|
||||
"description": "30天通行证",
|
||||
"priceText": "¥28.00",
|
||||
"durationDays": 30,
|
||||
"tier": "Basic",
|
||||
"subscribeId": 1001
|
||||
},
|
||||
"com.airport.vpn.pass.90d": {
|
||||
"description": "90天通行证",
|
||||
"priceText": "¥68.00",
|
||||
"durationDays": 90,
|
||||
"tier": "Pro",
|
||||
"subscribeId": 1002
|
||||
}
|
||||
},
|
||||
"iapBundleId": "co.airoport.app.ios"
|
||||
}
|
||||
```
|
||||
|
||||
- 字段说明:
|
||||
- `iapProductMap`:`productId → 映射`,用于后端计算到期时间与绑定内部计划(`subscribeId`)。
|
||||
- `description`/`priceText`:客户端展示文案。
|
||||
- `durationDays`:非续期订阅的有效天数。
|
||||
- `tier`:权益等级标签,用于状态返回。
|
||||
- `subscribeId`:绑定到现有 `subscribe` 计划 ID。
|
||||
- `iapBundleId`:客户端 Bundle ID(可用于后端基础校验)。
|
||||
|
||||
### 接口速览
|
||||
- `GET /v1/public/iap/apple/products`:返回可售商品与文案(基于 `iapProductMap`)。
|
||||
- `POST /v1/public/iap/apple/transactions/attach`:绑定一次购买到用户,入参 `signed_transaction_jws`。
|
||||
- `POST /v1/public/iap/apple/restore`:恢复历史购买(批量 JWS)。
|
||||
- `GET /v1/public/iap/apple/status`:返回用户的 IAP 权益状态与到期时间。
|
||||
|
||||
Reference in New Issue
Block a user