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 {