Browse Source

球幕视频链接、hot.json、link-scene.json去掉oss和s3的域名

dengsixing 2 years ago
parent
commit
ca0959f715

+ 11 - 7
src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -355,8 +355,8 @@ public class SceneDownloadHandlerServiceImpl {
             this.updateProgress( null, num, SceneDownloadProgressStatus.DOWNLOAD_FAILED.code(), null, "v3");
             throw e;
         }finally {
-            FileUtil.del(zipPath);
-            FileUtil.del(String.format(this.sourceLocal, num, ""));
+//            FileUtil.del(zipPath);
+//            FileUtil.del(String.format(this.sourceLocal, num, ""));
         }
     }
 
@@ -550,14 +550,16 @@ public class SceneDownloadHandlerServiceImpl {
         JSONObject controls = sceneJson.getJSONObject("controls");
         controls.set("showLock", 0);
         String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
-        FileUtil.writeUtf8String(sceneJson.toString(), String.format(this.sourceLocal, num, this.wwwroot + sceneJsonPath));
+        String sceneJsonStr = sceneJson.toString().replace(this.publicUrl, "");
+        FileUtil.writeUtf8String(sceneJsonStr, String.format(this.sourceLocal, num, this.wwwroot + sceneJsonPath));
     }
 
     private void zipGetInfoJson(String num, JSONObject getInfo) throws Exception{
 
         //访问密码置0
         String getInfoKey = String.format("data/data%s/", num) + "getInfo.json";
-        FileUtil.writeUtf8String(getInfo.toString(), String.format(this.sourceLocal, num, this.wwwroot + getInfoKey));
+        String getInfoStr = getInfo.toString().replace(this.publicUrl, "");
+        FileUtil.writeUtf8String(getInfoStr, String.format(this.sourceLocal, num, this.wwwroot + getInfoKey));
     }
 
     private void processImage(String sceneNum, String key, String resolution, int imagesVersion, Set<String> imgKeys) throws Exception{
@@ -644,9 +646,11 @@ public class SceneDownloadHandlerServiceImpl {
         String fileName = key.substring(key.lastIndexOf("/") + 1);
         String url = this.resourceUrl + key.replace(fileName, URLEncoder.encode(fileName, "UTF-8")) + "?t=" + Calendar.getInstance().getTimeInMillis();
         if(key.contains("hot.json") || key.contains("link-scene.json")){
-            String content = FileUtils.getStringFromUrl(url);
-
-            content.replace(publicUrl, "")
+            String content = fYunFileService.getFileContent(key);
+            if(StrUtil.isEmpty(content)){
+                return;
+            }
+            content = content.replace(publicUrl, "")
 //                .replace(publicUrl+"v3/", "")
                 .replace("https://spc.html","spc.html")
                 .replace("https://smobile.html", "smobile.html");