From 4011b8d0b377af33e2bc435f7726329630d706cb Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 02 三月 2021 18:28:52 +0800 Subject: [PATCH] 搜索引擎接口更新 --- src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java | 47 ++++++++++++++++++++++++++++++++++++----------- 1 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java index 689ca09..9ef8c45 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java @@ -7,11 +7,15 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import com.xxl.rpc.util.ThreadPoolUtil; import com.yeshi.buwan.domain.*; +import com.yeshi.buwan.domain.video.VideoWatchHistory; import com.yeshi.buwan.pptv.PPTVUtil; import com.yeshi.buwan.pptv.entity.PPTVSeries; import com.yeshi.buwan.service.imp.*; import com.yeshi.buwan.service.inter.juhe.PPTVService; +import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; +import com.yeshi.buwan.util.*; import com.yeshi.buwan.util.annotation.RequireUid; import com.yeshi.buwan.vo.AcceptData; import org.apache.commons.httpclient.HttpClient; @@ -20,14 +24,6 @@ import org.springframework.stereotype.Controller; import com.yeshi.buwan.domain.entity.PlayUrl; -import com.yeshi.buwan.util.CacheUtil; -import com.yeshi.buwan.util.Constant; -import com.yeshi.buwan.util.JsonUtil; -import com.yeshi.buwan.util.JuheVideoUtil; -import com.yeshi.buwan.util.StringUtil; -import com.yeshi.buwan.util.TimeUtil; -import com.yeshi.buwan.util.Utils; -import com.yeshi.buwan.util.VideoPictureUtil; import com.yeshi.buwan.util.JuHe.VideoResourceUtil; import com.yeshi.buwan.util.video.VideoDetailUtil; import com.yeshi.buwan.util.zhibo.MeiNvZhiBoUtil; @@ -75,6 +71,9 @@ @Resource private PPTVService pptvService; + + @Resource + private VideoWatchHistoryService videoWatchHistoryService; @RequireUid public void getHomeAd(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { @@ -157,7 +156,7 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); JSONObject object = new JSONObject(); - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getPlatform(), acceptData.getVersion()); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); List<HomeType> list1 = homeTypeService.getHomeType(detailSystem.getId(), resourceList, CacheUtil.getMD5Long(resourceList), -1, Long.parseLong(vtid)); List<HomeType> list = new ArrayList<>(); @@ -323,6 +322,7 @@ String resourceId = request.getParameter("ResourceId"); String thirdType = request.getParameter("Type"); String loginUid = request.getParameter("LoginUid"); + String position = request.getParameter("Position"); if (StringUtil.isNullOrEmpty(videoId)) { out.print(JsonUtil.loadFalseJson("璇蜂笂浼燰ideoId")); @@ -335,7 +335,7 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getPlatform(), acceptData.getVersion()); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); //鑾峰彇浼樺厛灞曠ず鐨勬笭閬� if (StringUtil.isNullOrEmpty(resourceId)) { @@ -347,11 +347,36 @@ } } + ThreadUtil.run(new Runnable() { + @Override + public void run() { + int p = 0; + if (!StringUtil.isNullOrEmpty(position)) { + p = Integer.parseInt(position); + } + + VideoWatchHistory history = new VideoWatchHistory(); + history.setDevice(acceptData.getDevice()); + history.setVideoId(videoId); + history.setUid(loginUid); + history.setPosition(p); + videoWatchHistoryService.add(history); + } + }); + + //PPTV缃戦〉鎾斁 if (resourceId != null && Integer.parseInt(resourceId) == PPTVUtil.RESOURCE_ID) { JSONObject data = new JSONObject(); PPTVSeries series = pptvService.getSeriesDetailByVideoId(videoId); - String playUrl = PPTVUtil.getPlayUrl(series, series.getSeries().get(0)); + int p = 0; + if (!StringUtil.isNullOrEmpty(position)) { + p = Integer.parseInt(position); + } + + p = p >= series.getSeries().size() ? 0 : p; + + String playUrl = PPTVUtil.getPlayUrl(series, series.getSeries().get(p)); data.put("videoId", videoId); data.put("playUrl", playUrl); data.put("pptv", true); -- Gitblit v1.8.0