From 4742874ad840d7e1e3ac79dc288b38e9a642319d Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期一, 02 六月 2025 19:11:00 +0800 Subject: [PATCH] bug修改 --- cloud-server-activity/src/main/java/com/dsh/activity/util/wx/WxV3PayConfig.java | 112 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 56 insertions(+), 56 deletions(-) diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/util/wx/WxV3PayConfig.java b/cloud-server-activity/src/main/java/com/dsh/activity/util/wx/WxV3PayConfig.java index 5797619..8c28a22 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/util/wx/WxV3PayConfig.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/util/wx/WxV3PayConfig.java @@ -1,56 +1,56 @@ -package com.dsh.activity.util.wx; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; // 如果需要静态访问 - -@Component -public class WxV3PayConfig { - - private String appIdValue = "wx41d32f362ba0f911"; - public static String APP_ID= "wx41d32f362ba0f911"; - - private String mchIdValue= "1681873607"; - public static String Mch_ID= "1681873607"; - - private String apiV3KeyValue= "1skiujh28376shznxmslwosiusytersq"; - public static String apiV3Key= "1skiujh28376shznxmslwosiusytersq"; - - private String mchSerialNoValue= "55714944F7A7E52526F708280B176DCC838F371A"; - public static String mchSerialNo= "55714944F7A7E52526F708280B176DCC838F371A"; - - private String privateKeyPathValue= "D:\\玩湃v3参数\\1681873607_20250424_cert\\apiclient_key.pem"; - public static String privateKeyPath= "D:\\玩湃v3参数\\1681873607_20250424_cert\\apiclient_key.pem"; - - // 如果需要静态访问,可以使用 @PostConstruct 初始化静态变量 - @PostConstruct - public void init() { - APP_ID = this.appIdValue; - Mch_ID = this.mchIdValue; - apiV3Key = this.apiV3KeyValue; - mchSerialNo = this.mchSerialNoValue; - privateKeyPath = this.privateKeyPathValue; // WXPaySignatureCertificateUtil 会用到这个路径 - - // 可以在这里加一些非空检查 - if (APP_ID == null || Mch_ID == null || apiV3Key == null || mchSerialNo == null || privateKeyPath == null) { - System.err.println("微信支付V3配置加载不完整,请检查配置文件!"); - // 在实际应用中,这里可能需要抛出异常或采取其他错误处理措施 - } else { - System.out.println("微信支付V3配置加载完成。"); - } - } - - // 注意: WXPaySignatureCertificateUtil 中的 getPrivateKey() 方法现在应该使用 WxV3PayConfig.privateKeyPath - // 你需要稍微修改 WXPaySignatureCertificateUtil.getPrivateKey() 方法: - /* - public static PrivateKey getPrivateKey() { - if (cachedPrivateKey != null) { - return cachedPrivateKey; - } - try { - String filePath = WxV3PayConfig.privateKeyPath; // 使用配置类中的路径 - // ... rest of the method ... - } // ... catch blocks ... - } - */ -} \ No newline at end of file +//package com.dsh.activity.util.wx; +// +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.stereotype.Component; +//import javax.annotation.PostConstruct; // 如果需要静态访问 +// +//@Component +//public class WxV3PayConfig { +// +// private String appIdValue = "wx41d32f362ba0f911"; +// public static String APP_ID= "wx41d32f362ba0f911"; +// +// private String mchIdValue= "1681873607"; +// public static String Mch_ID= "1681873607"; +// +// private String apiV3KeyValue= "1skiujh28376shznxmslwosiusytersq"; +// public static String apiV3Key= "1skiujh28376shznxmslwosiusytersq"; +// +// private String mchSerialNoValue= "55714944F7A7E52526F708280B176DCC838F371A"; +// public static String mchSerialNo= "55714944F7A7E52526F708280B176DCC838F371A"; +// +// private String privateKeyPathValue= "D:\\玩湃v3参数\\1681873607_20250424_cert\\apiclient_key.pem"; +// public static String privateKeyPath= "D:\\玩湃v3参数\\1681873607_20250424_cert\\apiclient_key.pem"; +// +// // 如果需要静态访问,可以使用 @PostConstruct 初始化静态变量 +// @PostConstruct +// public void init() { +// APP_ID = this.appIdValue; +// Mch_ID = this.mchIdValue; +// apiV3Key = this.apiV3KeyValue; +// mchSerialNo = this.mchSerialNoValue; +// privateKeyPath = this.privateKeyPathValue; // WXPaySignatureCertificateUtil 会用到这个路径 +// +// // 可以在这里加一些非空检查 +// if (APP_ID == null || Mch_ID == null || apiV3Key == null || mchSerialNo == null || privateKeyPath == null) { +// System.err.println("微信支付V3配置加载不完整,请检查配置文件!"); +// // 在实际应用中,这里可能需要抛出异常或采取其他错误处理措施 +// } else { +// System.out.println("微信支付V3配置加载完成。"); +// } +// } +// +// // 注意: WXPaySignatureCertificateUtil 中的 getPrivateKey() 方法现在应该使用 WxV3PayConfig.privateKeyPath +// // 你需要稍微修改 WXPaySignatureCertificateUtil.getPrivateKey() 方法: +// /* +// public static PrivateKey getPrivateKey() { +// if (cachedPrivateKey != null) { +// return cachedPrivateKey; +// } +// try { +// String filePath = WxV3PayConfig.privateKeyPath; // 使用配置类中的路径 +// // ... rest of the method ... +// } // ... catch blocks ... +// } +// */ +//} \ No newline at end of file -- Gitblit v1.7.1