From 206fcf7d6afae27856f63cf0158f53b61fa1b86f Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期五, 19 九月 2025 18:21:23 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-system/src/main/java/com/ruoyi/system/wxPay/model/V3.java |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/wxPay/model/V3.java b/ruoyi-system/src/main/java/com/ruoyi/system/wxPay/model/V3.java
index cdcbfc9..18062cb 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/wxPay/model/V3.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/wxPay/model/V3.java
@@ -28,6 +28,14 @@
      */
     private String privateKeyPath;
     /**
+     * 微信支付公钥id
+     */
+    private String publicKeyId;
+    /**
+     * 微信支付公钥证书 apiclient_cert.pem
+     */
+    private String publicKeyPath;
+    /**
      * 商户证书序列号
      */
     private String  mchSerialNo;
@@ -74,4 +82,27 @@
         }
         return new ByteArrayInputStream(certData);
     }
+
+    public InputStream getPublicKeyStream() {
+        // 需要证书释放
+        byte[] certData;
+//        InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(this.privateKeyPath);
+        InputStream certStream = null;
+        try {
+            certStream = new FileInputStream(this.publicKeyPath);
+            certData = IOUtils.toByteArray(certStream);
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new RuntimeException("公钥文件未找到");
+        }finally {
+            if(null != certStream){
+                try {
+                    certStream.close();
+                } catch (IOException e) {
+                    log.error("公钥流关闭异常");
+                }
+            }
+        }
+        return new ByteArrayInputStream(certData);
+    }
 }

--
Gitblit v1.7.1