瀏覽代碼

Merge remote-tracking branch 'origin/lc_saas' into lc_saas

dongpo 1 年之前
父節點
當前提交
9295dae937

+ 6 - 0
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/local/LocalFileClient.java

@@ -28,6 +28,12 @@ public class LocalFileClient extends AbstractFileClient<LocalFileClientConfig> {
 
     @Override
     public String upload(byte[] content, String path, String type) {
+        // 本地存储时,按日期进行分文件夹存储
+        LocalDate today = LocalDate.now();
+        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy/MM/dd/");
+        String directory = today.format(pattern);
+        path = directory + path;
+
         // 执行写入
         String filePath = getFilePath(path);
         FileUtil.writeBytes(content, filePath);