From 55f7e6cdbd00b0ab4a98fb8edde83e16a423baaa Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Wed, 29 Apr 2026 15:17:36 +0800
Subject: [PATCH] 修改minio配置

---
 multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java
index d3f79cc..479bd49 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysCommonServiceImpl.java
@@ -109,8 +109,15 @@
             log.error("文件复制失败: {}", e.getMessage());
             throw new ApiException("文件复制失败,请联系管理员");
         }
-        // 6. 返回新文件路径
-        return targetFilePath.replace("\\", "/");
+
+        String standardizedUploadPath = uploadPath.endsWith("/") || uploadPath.endsWith("\\")
+                ? uploadPath.substring(0, uploadPath.length() - 1)
+                : uploadPath;
+        // 6.2 拼接相对路径(统一用/分隔,格式:uploadPath/dateStr/newFileName)
+        String relativeFilePath = standardizedUploadPath + "/" + dateStr + "/" + newFileName;
+
+        // 7. 返回相对路径(替换原来的绝对路径)
+        return relativeFilePath;
 
     }
 

--
Gitblit v1.9.2