Selaa lähdekoodia

华为HAG CDN 切换

xushengqiang 4 vuotta sitten
vanhempi
commit
22ac9686cf

+ 7 - 1
src/main/java/cn/efunbox/audio/impl/hag/HagContentServiceImpl.java

@@ -189,12 +189,18 @@ public class HagContentServiceImpl implements HagContentService {
     }
 
 
-    private String md5PlayUrl(String key, String url){
+    /*private String md5PlayUrl(String key, String url){
         SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMddHHmm");
         long endTime = System.currentTimeMillis() + (3 * 60 * 1000L);
         Date date = new Date(endTime);
         String time = sdf.format(date);
         String md5Url = MD5.MD5Encode(key + time + url);
         return "/" + time + "/" + md5Url + url;
+    }*/
+
+    private String md5PlayUrl(String key, String url){
+            long time =  System.currentTimeMillis() / 1000;
+            String md5Url = MD5.MD5Encode(key  + url + time);
+            return "/"+  md5Url + "/" + time + url;
     }
 }

+ 20 - 0
src/main/java/cn/efunbox/audio/utils/BaseConstant.java

@@ -1,9 +1,29 @@
 package cn.efunbox.audio.utils;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 /**
  * 常量类
  */
 public class BaseConstant {
 
     public static final String HAG_SYNC_ORDER_TYPE = "Charge.SyncOrderRightRequest";
+
+
+    public static void main(String[] args) {
+
+        String md5PlayUrl = md5PlayUrl("efunbox1...", "/audio/022/02202002/02202002006.mp3");
+        System.out.println(md5PlayUrl);
+    }
+
+    private static String md5PlayUrl(String key, String url){
+//        SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMddHHmm");
+//        long endTime = System.currentTimeMillis() + (3 * 60 * 1000L);
+//        Date date = new Date(endTime);
+//        String time = sdf.format(new Date());
+        long time =  System.currentTimeMillis() / 1000;
+        String md5Url = MD5.MD5Encode(key  + url + time);
+        return "/"+  md5Url + "/" + time + url;
+    }
 }

+ 1 - 1
src/main/resources/application-dev.properties

@@ -70,5 +70,5 @@ efunbox.oss.img.url=https://ai-admin-image.ai160.com
 interface.sign.key=AzaSB2RR0boUz1WQ
 
 hag.cdn.secret.sign.key=7q28cAwmcGQgOsCj
-hag.oss.audio.prefix=http://ai-hag-audio.ai160.com
+hag.oss.audio.prefix=http://ai-hw-hag.ai160.com
 

+ 1 - 1
src/main/resources/application-prd.properties

@@ -70,5 +70,5 @@ interface.sign.key=IhOTiTyMLDNNLFuP
 
 
 hag.cdn.secret.sign.key=7q28cAwmcGQgOsCj
-hag.oss.audio.prefix=http://ai-hag-audio.ai160.com
+hag.oss.audio.prefix=http://ai-hw-hag.ai160.com