feat(appleIAP): 实现苹果应用内购买通知处理逻辑
Build docker and publish / build (20.15.1) (push) Successful in 6m36s
Build docker and publish / build (20.15.1) (push) Successful in 6m36s
添加苹果IAP通知处理功能,包括解析和验证JWS签名、处理交易状态变更 新增订单号字段用于关联订单处理 实现交易记录的创建和更新逻辑 处理订阅状态的变更和过期时间计算
This commit is contained in:
@@ -2,12 +2,21 @@ package notify
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"io"
|
||||
"encoding/json"
|
||||
"github.com/perfect-panel/server/internal/logic/notify"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
"github.com/perfect-panel/server/pkg/result"
|
||||
)
|
||||
|
||||
func AppleIAPNotifyHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
result.HttpResult(c, map[string]bool{"success": true}, nil)
|
||||
raw, _ := io.ReadAll(c.Request.Body)
|
||||
var body map[string]interface{}
|
||||
_ = json.Unmarshal(raw, &body)
|
||||
sp, _ := body["signedPayload"].(string)
|
||||
l := notify.NewAppleIAPNotifyLogic(c.Request.Context(), svcCtx)
|
||||
err := l.Handle(sp)
|
||||
result.HttpResult(c, map[string]bool{"success": err == nil}, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user