From cdc3690a0354e01b44852f4c9da3b7204128d2eb Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 13 八月 2021 18:46:36 +0800 Subject: [PATCH] 增加苹果内购回调日志,兼容苹果内购 --- src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java | 86 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 78 insertions(+), 8 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 1c443a9..5682ae2 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java @@ -13,6 +13,8 @@ import com.yeshi.buwan.domain.jump.JumpDetail; import com.yeshi.buwan.domain.jump.JumpTypeEnum; import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; +import com.yeshi.buwan.domain.solr.SolrShortVideo; +import com.yeshi.buwan.domain.special.SearchSpecialPositionMap; import com.yeshi.buwan.domain.system.DetailSystemConfig; import com.yeshi.buwan.domain.system.DetailSystem; import com.yeshi.buwan.domain.video.InternetSearchVideo; @@ -32,8 +34,10 @@ import com.yeshi.buwan.service.inter.juhe.YouKuService; import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; import com.yeshi.buwan.service.inter.recommend.HomeVideoService; +import com.yeshi.buwan.service.inter.search.SearchSpecialPositionMapService; import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; import com.yeshi.buwan.service.manager.VideoPlayStatisticManager; +import com.yeshi.buwan.service.manager.search.SolrShortVideoDataManager; import com.yeshi.buwan.tencent.TencentVideoUtil; import com.yeshi.buwan.util.*; import com.yeshi.buwan.util.annotation.RequireUid; @@ -41,6 +45,7 @@ import com.yeshi.buwan.util.log.LoggerUtil; import com.yeshi.buwan.util.log.UserActiveLogFactory; import com.yeshi.buwan.util.log.VideoLogFactory; +import com.yeshi.buwan.util.video.shortvideo.ShortVideoUtil; import com.yeshi.buwan.videos.bilibili.BilibiliUtil; import com.yeshi.buwan.vo.AcceptData; import com.yeshi.buwan.vo.video.VideoDetailVO; @@ -200,7 +205,7 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); JSONObject object = new JSONObject(); - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel()); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel()); List<HomeType> list1 = homeTypeService.getHomeType(detailSystem.getId(), acceptData.getPlatform(), acceptData.getVersion(), resourceList, CacheUtil.getMD5Long(resourceList), -1, special != null ? special.getDataKey() : null); List<HomeType> list = new ArrayList<>(); @@ -307,7 +312,7 @@ long count = homeTypeService.countHomeType(acceptData.getDetailSystem().getId(), acceptData.getVersion(), dataKey); - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel()); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel()); List<HomeType> homeTypeList = homeTypeService.getHomeTypeList(acceptData.getDetailSystem().getId(), acceptData.getVersion(), dataKey, Integer.parseInt(page), Integer.parseInt(pageSize)); if (homeTypeList != null) @@ -398,7 +403,7 @@ return; } - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel()); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel()); //鏌ヨ澶у浘 List<HomeVideo> bigPictureVideos = new ArrayList<>(); @@ -528,6 +533,9 @@ @Resource private VideoPlayStatisticManager videoPlayStatisticManager; + @Resource + private VideoResourceService videoResourceService; + private String createVideoDetailSessionId(AcceptData acceptData, String uid, String videoName, String videoId, String resourceId) { @@ -546,6 +554,31 @@ } return null; + } + + + @Resource + private SolrShortVideoDataManager solrShortVideoDataManager; + + public void getVideoDetailForShortVideo(AcceptData acceptData, String videoId, HttpServletRequest request, PrintWriter out) { + String loginUid = request.getParameter("LoginUid"); + SolrShortVideo solrShortVideo = solrShortVideoDataManager.findOne(videoId); + String resourceId = solrShortVideo.getResourceId() + ""; + VideoResource videoResource = videoResourceService.getResource(resourceId); + videoResource.setChecked(true); + VideoInfo info = VideoInfoFactory.create(solrShortVideo); + info.setResourceList(Arrays.asList(new VideoResource[]{videoResource})); + if (info != null) + info.setPageSize(1); + info.setWatchCount("" + (int) (Math.random() * 1000)); + info.setPlayPicture(info.getPicture()); + + JSONArray array = new JSONArray(); + JSONObject obj = new JSONObject(); + out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), + obj.toString())); +// out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), deviceAdStrategyService.getVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), loginUid), null, createVideoDetailSessionId(acceptData, loginUid, info.getName(), videoId, resourceId))), array.toString(), +// obj.toString())); } @@ -628,6 +661,11 @@ if (!NumberUtil.isNumeric(videoId)) { String[] cidVid = PPTVUtil.parseCidAndVidFromVisualVideoId(videoId); if (cidVid == null) { + //鐭棰� + if (ShortVideoUtil.isShortVideoId(videoId)) { + getVideoDetailForShortVideo(acceptData, videoId, request, out); + return; + } getVideoDetailForInternetSearch(acceptData, videoId, request, out); return; } @@ -672,7 +710,7 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel()); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel()); //鑾峰彇浼樺厛灞曠ず鐨勬笭閬� if (StringUtil.isNullOrEmpty(resourceId)) { @@ -917,10 +955,10 @@ return; } - if (StringUtil.isNullOrEmpty(type)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼爐ype")); - return; - } +// if (StringUtil.isNullOrEmpty(type)) { +// out.print(JsonUtil.loadFalseJson("璇蜂笂浼爐ype")); +// return; +// } if (StringUtil.isNullOrEmpty(id)) id = eid; @@ -989,4 +1027,36 @@ } } + + @Resource + private SearchSpecialPositionMapService searchSpecialPositionMapService; + + /** + * 鑾峰彇鎺ㄨ崘鐨勬悳绱笓棰� + * + * @param acceptData + * @param request + * @param out + */ + public void getRecommendSearchSpecial(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { + DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); + //鎺ㄨ崘鎼滅储涓撻 + DetailSystemConfig config = configService.getConfigByKey("recommend_search_special_position", detailSystem, acceptData.getVersion()); + if (config == null) { + out.print(JsonUtil.loadFalseAdmin("浣嶇疆涓虹┖")); + return; + } + String key = config.getValue(); + List<SearchSpecialPositionMap> mapList = searchSpecialPositionMapService.listDetailByPosition(key, 1, 20); + JSONArray array = new JSONArray(); + for (SearchSpecialPositionMap map : mapList) { + JSONObject item = new JSONObject(); + item.put("icon", map.getIcon()); + item.put("name", map.getShowName() == null ? map.getSpecial().getName() : map.getShowName()); + item.put("id", map.getSpecialId()); + array.add(item); + } + out.print(JsonUtil.loadTrueJson(array.toString())); + } + } -- Gitblit v1.8.0