This commit is contained in:
2026-01-16 14:54:28 +08:00
parent fb43d07245
commit 71af961cfb
9 changed files with 81 additions and 56 deletions

View File

@@ -4,12 +4,12 @@ import (
"context"
"fmt"
"net/http"
"strconv"
"time"
"qnc-server/app/main/api/internal/config"
"qnc-server/app/main/model"
"qnc-server/common/ctxdata"
"qnc-server/pkg/lzkit/lzUtils"
"strconv"
"time"
"github.com/wechatpay-apiv3/wechatpay-go/core"
"github.com/wechatpay-apiv3/wechatpay-go/core/auth/verifiers"
@@ -145,12 +145,9 @@ func newWechatPayServiceWithWxPayPubKey(c config.Config, userAuthModel model.Use
}
// 初始化 notify.Handler
// 使用 SHA256WithRSACombinedVerifier 同时支持平台证书和公钥验签
// 原因:微信回调目前仍使用平台证书签名,需要兼容处理;同时支持未来切换到公钥签名
certificateVisitor := downloader.MgrInstance().GetCertificateVisitor(mchID)
notifyHandler := notify.NewNotifyHandler(
mchAPIv3Key,
verifiers.NewSHA256WithRSACombinedVerifier(certificateVisitor, mchPublicKeyID, *mchPublicKey))
verifiers.NewSHA256WithRSAPubkeyVerifier(mchPublicKeyID, *mchPublicKey))
logx.Infof("微信支付客户端初始化成功(微信支付公钥方式)")
return &WechatPayService{
config: c,