From cd7767932dddeaf6d9c73a83d4a9b38f0341b77f Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 28 一月 2022 12:46:17 +0800 Subject: [PATCH] bug修复 --- src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java | 96 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 84 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java b/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java index eeed072..283684b 100644 --- a/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java +++ b/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java @@ -1,11 +1,17 @@ package com.yeshi.buwan.util.video; +import com.yeshi.buwan.domain.system.DetailSystem; +import com.yeshi.buwan.exception.video.VideoPlayException; +import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; +import com.yeshi.buwan.service.manager.APPManager; +import com.yeshi.buwan.util.JuHe.VideoResourceUtil; import com.yeshi.buwan.videos.acFun.AcFunUtil; import com.yeshi.buwan.dao.VideoInfoDao; import com.yeshi.buwan.domain.*; import com.yeshi.buwan.domain.entity.PlayUrl; import com.yeshi.buwan.videos.funtv.FunTVUtil; import com.yeshi.buwan.videos.funtv.FunTVUtil2; +import com.yeshi.buwan.videos.hanmi.HanmiUtil; import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil; import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil2; import com.yeshi.buwan.videos.mogotv.MogoTVUtil; @@ -88,7 +94,13 @@ private BilibiliVideoService bilibiliVideoService; @Resource + private HanmiService hanmiService; + + @Resource private BilibiliUtil bilibiliUtil; + + @Resource + private APPManager appManager; @SuppressWarnings("unchecked") // @Cacheable(value = "homeCache", key = "'getVideoInfo'+'-'+#videoid+'-'+#resourceId+'-'+#cacheMD5") @@ -232,6 +244,8 @@ return tencentVideoService.getVideoDetailList(videoid, page, pageSize); case BilibiliUtil.RESOURCE_ID: return bilibiliVideoService.getVideoDetailList(videoid, page, pageSize); + case HanmiUtil.RESOURCE_ID: + return hanmiService.getVideoDetailList(videoid, page, pageSize); default: return null; } @@ -255,6 +269,8 @@ return soHuService.getLatestVideoDetail(videoid); case MogoTVUtil.RESOURCE_ID: return soHuService.getLatestVideoDetail(videoid); + case HanmiUtil.RESOURCE_ID: + return hanmiService.getLatestVideoDetail(videoid); default: return null; } @@ -275,6 +291,8 @@ return soHuUtil.getShowType(videoid); case YouKuUtil.RESOURCE_ID: return soHuUtil.getShowType(videoid); + case HanmiUtil.RESOURCE_ID: + return hanmiService.getShowType(videoid); default: return 1; } @@ -286,39 +304,93 @@ @Resource private VideoResourceService videoResourceService; + @Resource + private VideoResourceUtil videoResourceUtil; + @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") - public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) { + public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) throws VideoPlayException { playLogger.info(VideoLogFactory.createPlayUrlLog(detailSystemId, id, type, resourceid, videoid)); + //鍒ゆ柇resourceId鏄惁鍦ㄥ厑璁告挱鏀剧殑鏉ユ簮鍒楄〃涓� + + List<Long> resourceIds = videoResourceUtil.getAvailablePlayResourceIds(new DetailSystem(detailSystemId), acceptData.getVersion(), acceptData.getChannel()); + if (resourceIds == null || !resourceIds.contains(Long.parseLong(resourceid + ""))) { + throw new VideoPlayException(1, "鎸囧畾鎾斁婧愭棤娉曟挱鏀�"); + } + + if (VideoUtil.getVideoFromType(id) == HomeVideo.FROM_TYPE_SHORT) { VideoResource vr = videoResourceService.getResource(resourceid + ""); return solrShortVideoDataManager.getPlayUrl(id, vr); } + String oldId = id; + if (id.startsWith("native_")) { + id = id.replace("native_", ""); + } + + + PlayUrl playUrl = null; + switch (resourceid) { case IqiyiUtil2.RESOURCE_ID: - return iqiyi2Service.getPlayUrl(detailSystemId, resourceid, id, videoid); + playUrl = iqiyi2Service.getPlayUrl(detailSystemId, resourceid, id, videoid); + break; case IqiyiUtil.RESOURCE_ID: - return iqiyiUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); + playUrl = iqiyiUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); + break; case FunTVUtil2.RESOURCE_ID: - return funTV2Service.getPlayUrl(acceptData, detailSystemId, resourceid, id, videoid); + playUrl = funTV2Service.getPlayUrl(acceptData, detailSystemId, resourceid, id, videoid); + break; case FunTVUtil.RESOURCE_ID: - return funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + playUrl = funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + break; case SoHuUtil.RESOURCE_ID: - return soHuUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); + playUrl = soHuUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); + break; case AcFunUtil.RESOURCE_ID: - return videoInfoService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + playUrl = videoInfoService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + break; case YouKuUtil.RESOURCE_ID: - return youKuUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + playUrl = youKuUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + break; case MogoTVUtil.RESOURCE_ID: - return mogoTVUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + playUrl = mogoTVUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + break; case TencentVideoUtil.RESOURCE_ID: - return tencentVideoUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + playUrl = tencentVideoUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + break; case BilibiliUtil.RESOURCE_ID: - return bilibiliUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + playUrl = bilibiliUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + break; + case HanmiUtil.RESOURCE_ID: + playUrl = hanmiService.getPlayUrl(detailSystemId, resourceid, id, videoid); + break; default: - return null; + throw new VideoPlayException(2, "鏈煡鎾斁婧�"); } + + if (playUrl != null) { + //闊╁墽 + if ("48".equalsIgnoreCase(acceptData.getDetailSystem().getId())) { + //姝e湪涓婄嚎 + //TODO 涓婄嚎鐨勬椂鍊欏紑鍚紝闃叉璇搷浣� +// if (appManager.isOnline(acceptData.getDetailSystem().getId(), acceptData.getVersion(), acceptData.getChannel())) { +// //闇�瑕佸師鐢熸挱鏀惧櫒 +// if (oldId != null && oldId.startsWith("native_")) { +// if (playUrl.getPlayType() == 1) { +// //鍘熺敓鎾斁鍣ㄦ挱鏀� +// playUrl.setPlayType(2); +// playUrl.setUrl("https://jx.parwix.com:4433/player/?url=" + playUrl.getUrl()); +// } +// } +// } + } + } + + return playUrl; + + } } -- Gitblit v1.8.0