From bbd7530f77ba50095a4a19290103904371be7836 Mon Sep 17 00:00:00 2001 From: lujiaming <1451771613@qq.com> Date: Mon, 10 Jul 2023 07:43:23 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20forceUpdatedCache=20?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE=EF=BC=8C=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=BC=93=E5=AD=98=E6=96=87=E4=BB=B6=E4=B8=8D?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lujiaming <1451771613@qq.com> --- .../main/java/cn/keking/utils/DownloadUtils.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/cn/keking/utils/DownloadUtils.java b/server/src/main/java/cn/keking/utils/DownloadUtils.java index 172be6f7..3d67b07f 100644 --- a/server/src/main/java/cn/keking/utils/DownloadUtils.java +++ b/server/src/main/java/cn/keking/utils/DownloadUtils.java @@ -124,11 +124,15 @@ public class DownloadUtils { if (!dirFile.exists() && !dirFile.mkdirs()) { logger.error("创建目录【{}】失败,可能是权限不够,请检查", fileDir); } - // 文件已在本地存在,跳过文件下载 - File realFile = new File(realPath); - if (realFile.exists()) { - fileAttribute.setSkipDownLoad(true); - return "cunzhai"; + Boolean forceUpdatedCache = fileAttribute.forceUpdatedCache(); + //判断是否启用强制更新功能如果启用 文件必须重新下载 + if (null == forceUpdatedCache || !forceUpdatedCache) { + // 文件已在本地存在,跳过文件下载 + File realFile = new File(realPath); + if (realFile.exists()) { + fileAttribute.setSkipDownLoad(true); + return "cunzhai"; //这里给的值是不能修改的 对应的是下载方法里面有个强制输出地址的 + } } return realPath; }