hi-server/internal/handler/notify/appleIAPNotifyHandler.go
shanshanzhong 3c6dd5058b
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 6m41s
feat(apple): 添加通过transaction_id附加苹果交易功能
新增通过transaction_id附加苹果交易的功能,包括:
1. 添加AttachAppleTransactionByIdRequest类型和对应路由
2. 实现AppleIAPConfig配置模型
3. 添加ServerAPI获取交易信息的实现
4. 优化JWS解析逻辑,增加cleanB64函数处理空格
5. 完善苹果通知处理逻辑的日志和注释
2025-12-15 22:35:33 -08:00

24 lines
649 B
Go

package notify
import (
"encoding/json"
"io"
"github.com/gin-gonic/gin"
"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)
}
}