Explorar el Código

OSS内网公共方法优化

lvy hace 4 días
padre
commit
a43722b17b

+ 7 - 2
blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java

@@ -1046,7 +1046,7 @@ public class CommonUtil {
         String filePath = getCacheValue(CommonConstant.SYS_LOCAL_URL);
         String sysFileNetUrl = getCacheValue(CommonConstant.SYS_FILE_NET_URL);
         String sysIsOnline = getCacheValue(CommonConstant.SYS_ISONLINE);
-        if (filePath.isEmpty() || sysFileNetUrl.isEmpty() || sysIsOnline.isEmpty()) {
+        if (StringUtils.isBlank(filePath) || StringUtils.isBlank(sysFileNetUrl) || StringUtils.isBlank(sysIsOnline)) {
             return fileUrl;
         }
         String filePath2 = getSysLocalFileUrl(filePath, sysIsOnline);
@@ -1058,7 +1058,12 @@ public class CommonUtil {
                     return sysFileNetUrl + fileUrl.replaceAll("//", "/").replaceAll(filePath2, "");
                 }
             }else{
-                return fileUrl;
+                if (SystemUtils.isLinux() && ("1".equals(sysIsOnline) || sysIsOnline.equals("20"))) {
+                    // 正式环境,走内网
+                    return fileUrl.replace("https://", "http://").replace("xinan1.zos.ctyun.cn", "100.86.2.1");
+                } else {
+                    return fileUrl;
+                }
             }
         } else {
             if("20".equals(sysIsOnline)){