From 2a593ddac16e06f1ff55edca22ea568f07b068ba Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 02 四月 2021 19:15:18 +0800 Subject: [PATCH] 3.9.0bug修改 --- src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java | 98 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 95 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 4b3c645..2536893 100644 --- a/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java +++ b/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java @@ -4,13 +4,14 @@ import com.yeshi.buwan.domain.VideoType; import com.yeshi.buwan.pptv.entity.PPTVProgram; import com.yeshi.buwan.pptv.entity.PPTVSeries; +import com.yeshi.buwan.util.AESUtil; import com.yeshi.buwan.util.StringUtil; import com.yeshi.buwan.util.video.VideoConstant; import com.yeshi.buwan.vo.AcceptData; public class PPTVUtil { - public final static int RESOURCE_ID=25; + public final static int RESOURCE_ID = 25; public final static int PLAY_NONE = 0;// 涓嶈兘鎾斁 public final static int PLAY_HTML = 1;// 璺宠浆绉诲姩绔綉椤垫挱鏀� @@ -37,7 +38,11 @@ case "鍔ㄦ极": videoType = VideoConstant.VIDEO_CATEGORY_DONGMAN; break; + case "灏戝効": + videoType = 312; + break; default: + return null; } return (long) videoType; @@ -60,14 +65,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() + "闆�"; @@ -78,6 +87,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() + "闆�"; + } + } } } @@ -128,4 +151,73 @@ } } + /** + * 鑾峰彇pptv鐨勭敤鎴稩D + * + * @param uid + * @return + */ + public static String getPPTVUid(String uid) { + return "buwan_" + uid; + } + + /** + * 鑾峰彇pptvcode + * + * @param pptvUid + * @return + */ + public static String getPPTVCode(String pptvUid) { + if (StringUtil.isNullOrEmpty(pptvUid)) + return null; + return AESUtil.encrypt(pptvUid + "#" + System.currentTimeMillis()).replace("/", "_").replace("=", "-"); + } + + public static String getUidFromPPTVUid(String pptvUid) { + return pptvUid.split("_")[1]; + } + + + /** + * 瑙e瘑PPTVCode + * + * @param code + * @return + */ + public static PPTVCodeInfo decryptPPTVCode(String code) { + code = code.replace("_", "/").replace("-", "="); + String info = AESUtil.decrypt(code); + if (StringUtil.isNullOrEmpty(info)) { + return null; + } else { + String[] sts = info.split("#"); + if (sts.length != 2) + return null; + PPTVCodeInfo codeInfo = new PPTVCodeInfo(); + codeInfo.pptvUid = sts[0]; + codeInfo.time = Long.parseLong(sts[1]); + return codeInfo; + } + } + + + /** + * 鑾峰彇鎾斁閾炬帴 + * + * @param series + * @param program + * @return + */ + 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); + } + + + public static class PPTVCodeInfo { + public String pptvUid; + public long time; + } + } -- Gitblit v1.8.0