Zhangbw пре 2 месеци
родитељ
комит
b8f53d424b

+ 7 - 7
ruoyi-admin/src/main/resources/application-prod.yml

@@ -1,10 +1,10 @@
 --- # 临时文件存储位置 避免临时文件被系统清理报错
-spring.servlet.multipart.location: /ruoyi/server/temp
+spring.servlet.multipart.location: ./temp
 
 --- # 监控中心配置
 spring.boot.admin.client:
   # 增加客户端开关
-  enabled: true
+  enabled: false
   url: http://localhost:9090/admin
   instance:
     service-host-type: IP
@@ -16,7 +16,7 @@ spring.boot.admin.client:
 
 --- # snail-job 配置
 snail-job:
-  enabled: true
+  enabled: false
   # 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
   group: "ruoyi_group"
   # SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config`表
@@ -50,9 +50,9 @@ spring:
           driverClassName: com.mysql.cj.jdbc.Driver
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
-          url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
-          username: root
-          password: root
+          url: jdbc:mysql://localhost:3306/ry_vue_5.x?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
+          username: gupiao
+          password: zQpdD3AmAPNCTFMyYARWMXnHSAbeHKEDNDHDYDZrFTAYGXGNVs
 #        # 从库数据源
 #        slave:
 #          lazy: true
@@ -105,7 +105,7 @@ spring.data:
     # 数据库索引
     database: 0
     # redis 密码必须配置
-    password: ruoyi123
+#    password: ruoyi123
     # 连接超时时间
     timeout: 10s
     # 是否开启ssl

+ 11 - 28
ruoyi-modules/yp-miniapp/src/main/java/com/yingpai/miniapp/service/impl/PaymentConfigServiceImpl.java

@@ -30,25 +30,8 @@ public class PaymentConfigServiceImpl implements IPaymentConfigService {
 
     private final SysConfigMapper sysConfigMapper;
 
-    /** 证书保存目录(模块resources/cert下) */
-    private String getCertDir() {
-        try {
-            // 获取当前模块的resources目录
-            String resourcePath = this.getClass().getClassLoader().getResource("").getPath();
-            // Windows路径处理
-            if (resourcePath.startsWith("/")) {
-                resourcePath = resourcePath.substring(1);
-            }
-            // 开发环境:target/classes -> src/main/resources
-            if (resourcePath.contains("target/classes")) {
-                resourcePath = resourcePath.replace("target/classes", "src/main/resources");
-            }
-            return resourcePath + "cert";
-        } catch (Exception e) {
-            log.error("获取resources路径失败", e);
-            throw new RuntimeException("获取证书目录失败", e);
-        }
-    }
+    /** 证书保存目录(运行目录/cert下,仿照日志保存方式) */
+    private static final String CERT_DIR = "./cert";
 
     // 配置key
     private static final String SHORT_PRICE_KEY = "payment.short.price";
@@ -117,15 +100,15 @@ public class PaymentConfigServiceImpl implements IPaymentConfigService {
     public boolean savePrivateKey(MultipartFile file) {
         try {
             // 保存到resources/cert目录
-            String certDir = getCertDir();
+            String certDir = CERT_DIR;
             File dir = new File(certDir);
             if (!dir.exists()) {
                 boolean created = dir.mkdirs();
                 log.info("创建目录 {}: {}", certDir, created);
             }
 
-            String filePath = certDir + "/apiclient_key.pem";
-            File destFile = new File(filePath);
+            File destFile = new File(certDir, "apiclient_key.pem");
+            String filePath = destFile.getAbsolutePath();
             
             // 使用 InputStream 写入文件,避免 transferTo 在 Windows 上的问题
             try (InputStream is = file.getInputStream();
@@ -152,15 +135,15 @@ public class PaymentConfigServiceImpl implements IPaymentConfigService {
     public boolean saveCert(MultipartFile file) {
         try {
             // 保存到resources/cert目录
-            String certDir = getCertDir();
+            String certDir = CERT_DIR;
             File dir = new File(certDir);
             if (!dir.exists()) {
                 boolean created = dir.mkdirs();
                 log.info("创建目录 {}: {}", certDir, created);
             }
 
-            String filePath = certDir + "/apiclient_cert.pem";
-            File destFile = new File(filePath);
+            File destFile = new File(certDir, "apiclient_cert.pem");
+            String filePath = destFile.getAbsolutePath();
             
             // 使用 InputStream 写入文件,避免 transferTo 在 Windows 上的问题
             try (InputStream is = file.getInputStream();
@@ -187,15 +170,15 @@ public class PaymentConfigServiceImpl implements IPaymentConfigService {
     public boolean savePublicKey(MultipartFile file) {
         try {
             // 保存到resources/cert目录
-            String certDir = getCertDir();
+            String certDir = CERT_DIR;
             File dir = new File(certDir);
             if (!dir.exists()) {
                 boolean created = dir.mkdirs();
                 log.info("创建目录 {}: {}", certDir, created);
             }
 
-            String filePath = certDir + "/pub_key.pem";
-            File destFile = new File(filePath);
+            File destFile = new File(certDir, "pub_key.pem");
+            String filePath = destFile.getAbsolutePath();
             
             // 使用 InputStream 写入文件
             try (InputStream is = file.getInputStream();