From eb7f3343af839a7c71f16e8ada2b25d5e2201c08 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 19 四月 2021 19:27:52 +0800
Subject: [PATCH] bug修复

---
 src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java |   44 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java b/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java
index d23efa9..ff04783 100644
--- a/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java
+++ b/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java
@@ -9,6 +9,9 @@
 import com.yeshi.buwan.util.video.VideoConstant;
 import com.yeshi.buwan.vo.AcceptData;
 
+import java.util.HashSet;
+import java.util.Set;
+
 public class PPTVUtil {
 
     public final static int RESOURCE_ID = 25;
@@ -38,7 +41,11 @@
             case "鍔ㄦ极":
                 videoType = VideoConstant.VIDEO_CATEGORY_DONGMAN;
                 break;
+            case "灏戝効":
+                videoType = 312;
+                break;
             default:
+                return null;
         }
 
         return (long) videoType;
@@ -61,14 +68,18 @@
         String score = series.getScore();
 
         String tag = "";
-        VideoType videoType = new VideoType(getVideoType(series));
+        Long videoTypeId = getVideoType(series);
+        if (videoTypeId == null)
+            return null;
+        VideoType videoType = new VideoType(videoTypeId);
+
 
         //鐢靛奖
         if (videoType.getId() == VideoConstant.VIDEO_CATEGORY_DIANYING) {
             tag = "璇勫垎锛�" + score;
         } else if (videoType.getId() == VideoConstant.VIDEO_CATEGORY_DIANSHIJU || videoType.getId() == VideoConstant.VIDEO_CATEGORY_DONGMAN) {
             //鐢佃鍓э紝鍔ㄦ极
-            if (series.getSeriesCount().trim().equalsIgnoreCase(series.getCurrentNum().trim())) {
+            if (series.getCurrentNum() != null && series.getSeriesCount().trim().equalsIgnoreCase(series.getCurrentNum().trim())) {
                 tag = series.getSeriesCount() + "闆嗗叏";
             } else {
                 tag = "鏇存柊鑷�" + series.getCurrentNum() + "闆�";
@@ -79,6 +90,20 @@
                 tag = series.getCurrentNum().replace("鏈�", "");
             } else {
                 tag = series.getPublishTime().split(" ")[0];
+            }
+        } else {
+            if ("1".equalsIgnoreCase(series.getSeriesCount())) {
+                tag = "璇勫垎锛�" + score;
+            } else {
+                if (series.getCurrentNum() != null && series.getSeriesCount().trim().equalsIgnoreCase(series.getCurrentNum().trim())) {
+                    tag = series.getSeriesCount() + "闆嗗叏";
+                } else {
+                    if (series.getCurrentNum() != null)
+                        tag = "鏇存柊鑷�" + series.getCurrentNum() + "闆�";
+                    else {
+                        tag = "鏇存柊鑷�" + series.getSeriesCount() + "闆�";
+                    }
+                }
             }
         }
 
@@ -148,7 +173,7 @@
     public static String getPPTVCode(String pptvUid) {
         if (StringUtil.isNullOrEmpty(pptvUid))
             return null;
-        return AESUtil.encrypt(pptvUid + "#" + System.currentTimeMillis());
+        return AESUtil.encrypt(pptvUid + "#" + System.currentTimeMillis()).replace("/", "_").replace("=", "-");
     }
 
     public static String getUidFromPPTVUid(String pptvUid) {
@@ -163,6 +188,7 @@
      * @return
      */
     public static PPTVCodeInfo decryptPPTVCode(String code) {
+        code = code.replace("_", "/").replace("-", "=");
         String info = AESUtil.decrypt(code);
         if (StringUtil.isNullOrEmpty(info)) {
             return null;
@@ -188,6 +214,7 @@
     public static String getPlayUrl(PPTVSeries series, PPTVProgram program) {
         //programtype 鐢靛奖-3  鍏朵粬-2
         return String.format("https://acmd.api.pptv.com/2021/bwysdqmovie_thrid_h5.html?cid=%s&vid=%s&programtype=%s", series.getSeriesCode(), program.getProgramCode(), series.getProgramType().contains("鐢靛奖") ? 3 : 2);
+//        return String.format(" http://vip.pptv.com/activity/2021/pg_bwysdqmovie?cid=%s&vid=%s&programtype=%s", series.getSeriesCode(), program.getProgramCode(), series.getProgramType().contains("鐢靛奖") ? 3 : 2);
     }
 
 
@@ -196,4 +223,15 @@
         public long time;
     }
 
+    public static Set<String> getAvaiableStates() {
+        Set<String> stateSets = new HashSet<>();
+        stateSets.add("add");
+        stateSets.add("update");
+        return stateSets;
+    }
+
+    public static boolean isVIPVideo(String free) {
+        return "1".equalsIgnoreCase((free + "").trim());
+    }
+
 }

--
Gitblit v1.8.0