From c5ad64c474ba164606ac7b4af5a49245d108b5ee Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 20 Dec 2023 13:35:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1=E9=80=80?= =?UTF-8?q?=E6=AC=BE=E4=BD=BF=E7=94=A8=E5=95=86=E6=88=B7=E5=8F=B7=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E9=97=AE=E8=AF=8A=E4=BD=BF=E7=94=A8=E6=96=B0?= =?UTF-8?q?=E5=95=86=E6=88=B7=E5=8F=B72?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/weChat/weChatPay.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extend/weChat/weChatPay.go b/extend/weChat/weChatPay.go index e67ed6a..e5f6f26 100644 --- a/extend/weChat/weChatPay.go +++ b/extend/weChat/weChatPay.go @@ -8,6 +8,7 @@ import ( "github.com/wechatpay-apiv3/wechatpay-go/services/refunddomestic" "github.com/wechatpay-apiv3/wechatpay-go/utils" "hospital-admin-api/config" + "path/filepath" ) type RefundRequest struct { @@ -35,9 +36,10 @@ func (r RefundRequest) Refund(orderType int) (*refunddomestic.Refund, error) { return nil, errors.New("商户号错误") } - certsDir := "extend/weChat/certs/" + mchId + "/apiclient_key.pem" + // certsDir := "extend/weChat/certs/" + mchId + "/apiclient_key.pem" // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + certsDir := filepath.Join("extend/weChat/certs", mchId, "/apiclient_key.pem") // certsDir := filepath.Join("extend/weChat/certs", "/1636644248/apiclient_key.pem") mchPrivateKey, err := utils.LoadPrivateKeyWithPath(certsDir) if err != nil {