This commit is contained in:
2026-08-04 14:45:17 +08:00
parent 4e556ea78a
commit e64421295f
40 changed files with 869 additions and 207 deletions
@@ -51,14 +51,18 @@ func MemberNotify(r *ghttp.Request) {
ok := service.PaymentOrderService.VerifyNotify(params, hash, g.Cfg().MustGet(ctx, "payment.xunhu_appsecret", "").String())
if !ok {
_ = service.PayNotifyLogService.Insert(ctx, orderNo, body, hash, remoteIP, "bad_sign")
if err := service.PayNotifyLogService.Insert(ctx, orderNo, body, hash, remoteIP, "bad_sign"); err != nil {
g.Log().Warningf(ctx, "写入支付回调日志失败(bad_sign: %v", err)
}
r.Response.Write("fail")
r.ExitAll()
return
}
state, err := service.PaymentOrderService.HandlePaidNotify(ctx, orderNo, r.Get("transaction_id").String(), body)
_ = service.PayNotifyLogService.Insert(ctx, orderNo, body, hash, remoteIP, state)
if logErr := service.PayNotifyLogService.Insert(ctx, orderNo, body, hash, remoteIP, state); logErr != nil {
g.Log().Warningf(ctx, "写入支付回调日志失败: %v", logErr)
}
// duplicate(幂等重复回调)同样返回 success,避免支付渠道无限重试
if err != nil || state == "no_order" {
r.Response.Write("fail")