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:
+38
-12
@@ -72,18 +72,9 @@ type AppUserSubscbribeNode struct {
|
||||
}
|
||||
|
||||
type AppleLoginCallbackRequest struct {
|
||||
Code string `form:"code"`
|
||||
IDToken string `form:"id_token"`
|
||||
State string `form:"state"`
|
||||
}
|
||||
|
||||
type IAPVerifyRequest struct {
|
||||
OriginalTransactionId string `json:"original_transaction_id" validate:"required"`
|
||||
SubscribeId int64 `json:"subscribe_id" validate:"required"`
|
||||
}
|
||||
|
||||
type IAPVerifyResponse struct {
|
||||
OrderNo string `json:"order_no"`
|
||||
Code string `form:"code"`
|
||||
IDToken string `form:"id_token"`
|
||||
State string `form:"state"`
|
||||
}
|
||||
|
||||
type Application struct {
|
||||
@@ -2853,3 +2844,38 @@ type VmessProtocol struct {
|
||||
Network string `json:"network"`
|
||||
Transport string `json:"transport"`
|
||||
}
|
||||
|
||||
type AppleProduct struct {
|
||||
ProductId string `json:"product_id"`
|
||||
Description string `json:"description"`
|
||||
PriceText string `json:"price_text"`
|
||||
DurationDays int64 `json:"duration_days"`
|
||||
Tier string `json:"tier"`
|
||||
SubscribeId int64 `json:"subscribe_id"`
|
||||
}
|
||||
|
||||
type GetAppleProductsResponse struct {
|
||||
List []AppleProduct `json:"list"`
|
||||
}
|
||||
|
||||
type AttachAppleTransactionRequest struct {
|
||||
SignedTransactionJWS string `json:"signed_transaction_jws" validate:"required"`
|
||||
DurationDays int64 `json:"duration_days,omitempty"`
|
||||
Tier string `json:"tier,omitempty"`
|
||||
SubscribeId int64 `json:"subscribe_id,omitempty"`
|
||||
}
|
||||
|
||||
type AttachAppleTransactionResponse struct {
|
||||
ExpiresAt int64 `json:"expires_at"`
|
||||
Tier string `json:"tier"`
|
||||
}
|
||||
|
||||
type RestoreAppleTransactionsRequest struct {
|
||||
Transactions []string `json:"transactions" validate:"required"`
|
||||
}
|
||||
|
||||
type GetAppleStatusResponse struct {
|
||||
Active bool `json:"active"`
|
||||
ExpiresAt int64 `json:"expires_at"`
|
||||
Tier string `json:"tier"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user