From 56481656c7de11cdca69c1a7dd69db176ffd9ecd Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 08 五月 2021 12:49:30 +0800 Subject: [PATCH] 华为屏蔽金币任务中的看海量视频,新增广告平台概率控制 --- src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java | 99 +++++++++++++++++++++++++++++++++++-------------- 1 files changed, 71 insertions(+), 28 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 841bfca..5deea04 100644 --- a/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java +++ b/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java @@ -11,18 +11,23 @@ import com.yeshi.buwan.funtv.FunTVUtil2; import com.yeshi.buwan.iqiyi.util.IqiyiUtil; import com.yeshi.buwan.iqiyi.util.IqiyiUtil2; -import com.yeshi.buwan.pptv.PPTVUtil; +import com.yeshi.buwan.mogotv.MogoTVUtil; import com.yeshi.buwan.service.imp.VideoInfoService; import com.yeshi.buwan.service.imp.juhe.FunTVService; import com.yeshi.buwan.service.imp.juhe.IqiyiService; -import com.yeshi.buwan.service.imp.juhe.PPTVService; import com.yeshi.buwan.service.imp.juhe.SoHuService; -import com.yeshi.buwan.service.inter.juhe.FunTV2Service; -import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service; +import com.yeshi.buwan.service.inter.juhe.*; import com.yeshi.buwan.sohu.SoHuUtil; +import com.yeshi.buwan.tencent.TencentVideoUtil; import com.yeshi.buwan.util.StringUtil; +import com.yeshi.buwan.util.log.VideoLogFactory; +import com.yeshi.buwan.videos.bilibili.BilibiliUtil; +import com.yeshi.buwan.vo.AcceptData; +import com.yeshi.buwan.youku.YouKuUtil; import org.hibernate.HibernateException; import org.hibernate.Session; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.cache.annotation.Cacheable; import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Component; @@ -32,6 +37,9 @@ @Component public class VideoDetailUtil { + + private final Logger playLogger = LoggerFactory.getLogger("videoPlay"); + @Resource private IqiyiUtil iqiyiUtil; @@ -57,16 +65,37 @@ private FunTV2Service funTV2Service; @Resource - private PPTVService pptvService; + private VideoInfoService videoInfoService; @Resource - private VideoInfoService videoInfoService; + private YouKuUtil youKuUtil; + + @Resource + private YouKuService youKuService; + + @Resource + private MogoTVUtil mogoTVUtil; + + @Resource + private MogoTVService mogoTVService; + + @Resource + private TencentVideoService tencentVideoService; + + @Resource + private TencentVideoUtil tencentVideoUtil; + + @Resource + private BilibiliVideoService bilibiliVideoService; + + @Resource + private BilibiliUtil bilibiliUtil; @SuppressWarnings("unchecked") // @Cacheable(value = "homeCache", key = "'getVideoInfo'+'-'+#videoid+'-'+#resourceId+'-'+#cacheMD5") - public VideoInfo getVideoInfo(final String videoid, final String resourceId, final List<Long> reList, + public VideoInfo getVideoInfo(String detailSystemId, final String videoid, final String resourceId, final List<Long> reList, String cacheMD5) { - + playLogger.info(VideoLogFactory.createVideoDetailLog(detailSystemId, videoid, resourceId)); return (VideoInfo) videoInfoDao.excute(new HibernateCallback<VideoInfo>() { public VideoInfo doInHibernate(Session session) throws HibernateException { @@ -93,7 +122,7 @@ .createQuery("select rv.resource from ResourceVideo rv where rv.video.id=?") .setParameter(0, videoid).list(); - rv.getVideo().setVideoDetailList(getVideoDetailList(videoid, rv.getResource())); + rv.getVideo().setVideoDetailList(getVideoDetailList(videoid, rv.getResource(), 1, 100)); for (VideoResource r : resourceList) { if (r.getId().equalsIgnoreCase(rv.getResource().getId())) { r.setChecked(true); @@ -133,7 +162,7 @@ "select rv.resource from ResourceVideo rv where rv.video.id=? order by rv.resource.id desc") .setParameter(0, videoid).list(); - rv.getVideo().setVideoDetailList(getVideoDetailList(videoid, rv.getResource())); + rv.getVideo().setVideoDetailList(getVideoDetailList(videoid, rv.getResource(), 1, 100)); for (int i = 0; i < resourceList.size(); i++) { VideoResource r = resourceList.get(i); @@ -181,23 +210,29 @@ }); } - private List<VideoDetailInfo> getVideoDetailList(String videoid, VideoResource vr) { + public List<VideoDetailInfo> getVideoDetailList(String videoid, VideoResource vr, int page, int pageSize) { int resourceId = Integer.parseInt(vr.getId()); switch (resourceId) { case IqiyiUtil2.RESOURCE_ID: - return iqiyi2Service.getVideoDetailList(videoid); + return iqiyi2Service.getVideoDetailList(videoid, page, pageSize); case IqiyiUtil.RESOURCE_ID: - return iqiyiService.getVideoDetailList(videoid); + return iqiyiService.getVideoDetailList(videoid, page, pageSize); case FunTVUtil2.RESOURCE_ID: - return funTV2Service.getVideoDetailList(videoid); + return funTV2Service.getVideoDetailList(videoid, page, pageSize); case FunTVUtil.RESOURCE_ID: - return funTVService.getVideoDetailList(videoid); - case PPTVUtil.RESOURCE_ID: - return pptvService.getVideoDetailList(videoid); + return funTVService.getVideoDetailList(videoid, page, pageSize); case AcFunUtil.RESOURCE_ID: - return videoInfoService.getVideoDetailList(videoid, vr); + return videoInfoService.getVideoDetailList(videoid, vr, page, pageSize); case SoHuUtil.RESOURCE_ID: - return soHuService.getVideoDetailList(videoid); + return soHuService.getVideoDetailList(videoid, page, pageSize); + case YouKuUtil.RESOURCE_ID: + return youKuService.getVideoDetailList(videoid, page, pageSize); + case MogoTVUtil.RESOURCE_ID: + return mogoTVService.getVideoDetailList(videoid, page, pageSize); + case TencentVideoUtil.RESOURCE_ID: + return tencentVideoService.getVideoDetailList(videoid, page, pageSize); + case BilibiliUtil.RESOURCE_ID: + return bilibiliVideoService.getVideoDetailList(videoid, page, pageSize); default: return null; } @@ -215,9 +250,11 @@ return funTV2Service.getLatestVideoDetail(videoid); case FunTVUtil.RESOURCE_ID: return funTVService.getLatestVideoDetail(videoid); - case PPTVUtil.RESOURCE_ID: - return pptvService.getLatestVideoDetail(videoid); case SoHuUtil.RESOURCE_ID: + return soHuService.getLatestVideoDetail(videoid); + case YouKuUtil.RESOURCE_ID: + return soHuService.getLatestVideoDetail(videoid); + case MogoTVUtil.RESOURCE_ID: return soHuService.getLatestVideoDetail(videoid); default: return null; @@ -235,9 +272,9 @@ return funTV2Service.getShowType(videoid); case FunTVUtil.RESOURCE_ID: return funTVService.getShowType(videoid); - case PPTVUtil.RESOURCE_ID: - return pptvService.getShowType(videoid); case SoHuUtil.RESOURCE_ID: + return soHuUtil.getShowType(videoid); + case YouKuUtil.RESOURCE_ID: return soHuUtil.getShowType(videoid); default: return 1; @@ -245,23 +282,29 @@ } @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") - public PlayUrl getPlayUrl(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) { + playLogger.info(VideoLogFactory.createPlayUrlLog(detailSystemId, id, type, resourceid, videoid)); switch (resourceid) { case IqiyiUtil2.RESOURCE_ID: return iqiyi2Service.getPlayUrl(detailSystemId, resourceid, id, videoid); case IqiyiUtil.RESOURCE_ID: return iqiyiUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); case FunTVUtil2.RESOURCE_ID: - return funTV2Service.getPlayUrl(detailSystemId, resourceid, id, videoid); + return funTV2Service.getPlayUrl(acceptData, detailSystemId, resourceid, id, videoid); case FunTVUtil.RESOURCE_ID: return funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); - case PPTVUtil.RESOURCE_ID: - return pptvService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); case SoHuUtil.RESOURCE_ID: return soHuUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); case AcFunUtil.RESOURCE_ID: return videoInfoService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + case YouKuUtil.RESOURCE_ID: + return youKuUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + case MogoTVUtil.RESOURCE_ID: + return mogoTVUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + case TencentVideoUtil.RESOURCE_ID: + return tencentVideoUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); + case BilibiliUtil.RESOURCE_ID: + return bilibiliUtil.getPlayUrl(detailSystemId, id, type, resourceid, videoid); default: return null; } -- Gitblit v1.8.0