lyhzzz 2 tahun lalu
induk
melakukan
12e442b429

+ 1 - 1
src/main/java/com/cdf/controller/service/FdkkSceneController.java

@@ -30,10 +30,10 @@ public class FdkkSceneController {
         map.put("num",num);
         NumRegion numRegion = fdkkUserService.getRegionByNum(num);
         try {
-            fdkkSceneEditService.writeHotJson(num,numRegion.getRegion());
             JSONObject info = fdkkClient.getInfo(map);
             Integer code = info.getInteger("code");
             if(code == 0){
+                fdkkSceneEditService.writeHotJson(num,numRegion.getRegion());
                 JSONObject data = info.getJSONObject("data");
                 data.put("cdfRegionData",numRegion);
             }

+ 16 - 11
src/main/java/com/cdf/service/impl/FdkkSceneEditService.java

@@ -192,18 +192,23 @@ public class FdkkSceneEditService {
         uploadToCdfOssUtil.upload(localPath,s3PathKey);
     }
 
-    public void writeHotJson(String num,String pType) throws IOException {
-        if(pType.equals("HK")){
-            writeHotJsonHk(num,"eshop_en");
-            writeHotJsonHk(num,"eshop_zh");
-            writeHotJsonHk(num,"eshop_cn");
-            return;
+    public void writeHotJson(String num,String pType) {
+        try {
+            if(pType.equals("HK")){
+                writeHotJsonHk(num,"eshop_en");
+                writeHotJsonHk(num,"eshop_zh");
+                writeHotJsonHk(num,"eshop_cn");
+                return;
+            }
+            JSONArray hotJson = getHotJson(num,pType,"all");
+            String path = String.format(hotLocalPath,num)+"/"+"hot.json";
+            String json = JSONUtil.toJsonStr(hotJson);
+            FileUtils.writeFile(path,json );
+            uploadToCdfOssUtil.upload(path,String.format(hotCdfPath, num));
+        }catch (Exception e){
+            log.error("writeHotJson",e);
         }
-        JSONArray hotJson = getHotJson(num,pType,"all");
-        String path = String.format(hotLocalPath,num)+"/"+"hot.json";
-        String json = JSONUtil.toJsonStr(hotJson);
-        FileUtils.writeFile(path,json );
-        uploadToCdfOssUtil.upload(path,String.format(hotCdfPath, num));
+
     }
 
     public  void writeHotJsonHk(String num,String lang){

+ 1 - 1
src/main/resources/application-test.yaml

@@ -48,7 +48,7 @@ fdkk:
   aws:
     s3key: AKIAWCV5QFZ3ZNELKYUY
     s3secrey: epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws
-    s3bucket: 4dkankan
+    s3bucket: test-4dkankan
 
 cdf:
   aws: