hi-server/internal/model/iap/apple/transaction.go
shanshanzhong 62186ca672
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 6m37s
feat(iap/apple): 实现苹果IAP非续期订阅功能
新增苹果IAP相关接口与逻辑,包括产品列表查询、交易绑定、状态查询和恢复购买功能。移除旧的IAP验证逻辑,重构订阅系统以支持苹果IAP交易记录存储和权益计算。

- 新增/pkg/iap/apple包处理JWS解析和产品映射
- 实现GET /products、POST /attach、POST /restore和GET /status接口
- 新增apple_iap_transactions表存储交易记录
- 更新文档说明配置方式和接口规范
- 移除旧的AppleIAP验证和通知处理逻辑
2025-12-13 20:54:50 -08:00

22 lines
939 B
Go

package apple
import "time"
type Transaction struct {
Id int64 `gorm:"primaryKey"`
UserId int64 `gorm:"index:idx_user_id;not null;comment:User ID"`
OriginalTransactionId string `gorm:"type:varchar(255);uniqueIndex:uni_original;not null;comment:Original Transaction ID"`
TransactionId string `gorm:"type:varchar(255);not null;comment:Transaction ID"`
ProductId string `gorm:"type:varchar(255);not null;comment:Product ID"`
PurchaseAt time.Time `gorm:"not null;comment:Purchase Time"`
RevocationAt *time.Time `gorm:"comment:Revocation Time"`
JWSHash string `gorm:"type:varchar(255);not null;comment:JWS Hash"`
CreatedAt time.Time `gorm:"<-:create;comment:Create Time"`
UpdatedAt time.Time `gorm:"comment:Update Time"`
}
func (Transaction) TableName() string {
return "apple_iap_transactions"
}