“djh”
4 days ago 9abc6588d464269024d3e680b98cfd71e2acc84e
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;
    }