hi-server/internal/handler/notify/appleIAPNotifyHandler.go
shanshanzhong 72400ae054
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 6m36s
feat(appleIAP): 实现苹果应用内购买通知处理逻辑
添加苹果IAP通知处理功能,包括解析和验证JWS签名、处理交易状态变更
新增订单号字段用于关联订单处理
实现交易记录的创建和更新逻辑
处理订阅状态的变更和过期时间计算
2025-12-15 17:49:16 -08:00

23 lines
648 B
Go

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) {
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)
}
}