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/controller/parser/HomeParser.java | 72 +++++++++++++++++++++++++++++------- 1 files changed, 58 insertions(+), 14 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 f6e89d9..29f7ee0 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java @@ -12,6 +12,8 @@ import com.yeshi.buwan.domain.video.VideoWatchHistory; import com.yeshi.buwan.dto.log.BaseLog; import com.yeshi.buwan.dto.statistic.video.VideoDetailStatisticData; +import com.yeshi.buwan.exception.video.VideoPlayException; +import com.yeshi.buwan.service.manager.APPManager; import com.yeshi.buwan.videos.mogotv.MogoTVUtil; import com.yeshi.buwan.videos.pptv.PPTVApiUtil; import com.yeshi.buwan.videos.pptv.PPTVUtil; @@ -116,6 +118,9 @@ @Resource private DeviceAdStrategyService deviceAdStrategyService; + @Resource + private APPManager appManager; + private final Logger userPlayLogger = LoggerFactory.getLogger("videoPlayUser"); @RequireUid @@ -203,9 +208,9 @@ List<HomeType> list = new ArrayList<>(); for (HomeType ht : list1) list.add(ht); - if ("309" .equals(vtid)) { - if (!"ios" .equalsIgnoreCase(acceptData.getPlatform())) { - Map<String, String> confMap = configService.getConfigAsMap(detailSystem, acceptData.getVersion()); + if ("309".equals(vtid)) { + if (!"ios".equalsIgnoreCase(acceptData.getPlatform())) { + Map<String, String> confMap = configService.getConfigAsMap(acceptData.getChildDetailSystem(), acceptData.getVersion()); String mm = confMap.get("meinv_mm_count"); int count = Integer.parseInt(mm); if (count > 0) { @@ -234,8 +239,8 @@ } if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion())) { - DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getDetailSystem(), acceptData.getVersion()); - DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getDetailSystem(), acceptData.getVersion()); + DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getChildDetailSystem(), acceptData.getVersion()); + DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getChildDetailSystem(), acceptData.getVersion()); if (adContent != null && adPosition != null) { HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class); int adP = Integer.parseInt(adPosition.getValue()); @@ -264,7 +269,7 @@ } } - if ("huawei" .equalsIgnoreCase(channel)) { + if ("huawei".equalsIgnoreCase(channel)) { for (int i = 0; i < list.size(); i++) { if (list.get(i).getName().equalsIgnoreCase("缇庡コ")) { list.remove(i); @@ -335,15 +340,15 @@ try { if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion()) && dataKey.equalsIgnoreCase("recommend")) { - DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getDetailSystem(), acceptData.getVersion()); - DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getDetailSystem(), acceptData.getVersion()); + DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getChildDetailSystem(), acceptData.getVersion()); + DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getChildDetailSystem(), acceptData.getVersion()); if (adContent != null && adPosition != null) { HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class); int adP = Integer.parseInt(adPosition.getValue()); if (adP < homeTypeList.size() && adP > -1) { HomeType homeType = new HomeType(); homeType.setAd(ad); - if ("1" .equalsIgnoreCase(page)) { + if ("1".equalsIgnoreCase(page)) { homeTypeList.add(adP, homeType); } count++; @@ -646,6 +651,9 @@ info.setWatchCount("" + (int) (Math.random() * 1000)); + //瑙嗛杩囨护 + filterVideo(acceptData, info); + JSONArray array = new JSONArray(); JSONObject obj = new JSONObject(); @@ -656,6 +664,33 @@ out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), obj.toString())); } + } + + //瑙嗛杩囨护 + private void filterVideo(AcceptData acceptData, VideoInfo video) { + //鎺у埗鍓嶇鍒楄〃涓殑鏉ユ簮鏄剧ず闂 + if ("48".equalsIgnoreCase(acceptData.getDetailSystem().getId())) { + if (video.getArea() != null && video.getArea().contains("闊╁浗")) { + //鍒ゆ柇褰撳墠鐗堟湰鏄惁姝e湪涓婄嚎 + if (appManager.isOnline(acceptData.getDetailSystem().getId(), acceptData.getVersion(), acceptData.getChannel())) { + //濡傛灉鍦ㄤ笂绾垮氨鍒犻櫎鏈�変腑鐨勮祫婧愶紝骞朵笖灏嗗綋鍓嶈祫婧愬彉涓洪煩杩稵V + for (int i = 0; i < video.getResourceList().size(); i++) { + if (!video.getResourceList().get(i).isChecked()) { + video.getResourceList().remove(i--); + } + } + if (video.getResourceList().size() > 0) { + video.getResourceList().get(0).setName("PP瑙嗛"); + //鍦↖D鍓嶉潰娣诲姞native鏍囪瘑 + for (VideoDetailInfo videoDetailInfo : video.getVideoDetailList()) { + videoDetailInfo.setExtraId("native_" + videoDetailInfo.getExtraId()); + } + } + } + } + + } + } @RequireUid @@ -788,7 +823,7 @@ data.put("playUrl", playUrl); data.put("name", videoName); data.put("pptv", true); - data.put("vip", "1" .equalsIgnoreCase(series.getFree())); + data.put("vip", "1".equalsIgnoreCase(series.getFree())); data.put("sessionId", sessionId); out.print(JsonUtil.loadTrueJson(data.toString())); LoggerUtil.getUserActiveLogger().info(UserActiveLogFactory.createVideoDetail(new BaseLog(acceptData, loginUid), videoId, series.getName(), from)); @@ -855,6 +890,10 @@ attentionInfo.put("IsAttention", attention.isAttention()); obj.put("Attention", attentionInfo); } + + //瑙嗛杩囨护 + filterVideo(acceptData, info); + UserInfo user = userService.getUserInfo(acceptData.getUid()); if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion())) { String sessionId = createVideoDetailSessionId(acceptData, loginUid, info.getName(), videoId, resourceId); @@ -976,7 +1015,12 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); - PlayUrl pu = videoDeailUtil.getPlayUrl(acceptData, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); + PlayUrl pu = null; + try { + pu = videoDeailUtil.getPlayUrl(acceptData, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); + } catch (VideoPlayException e) { + e.printStackTrace(); + } if (pu != null) { if (!StringUtil.isNullOrEmpty(pu.getUrl())) @@ -1030,8 +1074,8 @@ public void isPraise(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); - DetailSystemConfig config = configService.getConfigByKey("banner_praise", detailSystem, acceptData.getVersion()); - if ("鏄�" .equals(config.getValue())) { + DetailSystemConfig config = configService.getConfigByKey("banner_praise", acceptData.getChildDetailSystem(), acceptData.getVersion()); + if ("鏄�".equals(config.getValue())) { out.print(JsonUtil.loadTrueJson("1")); } else { out.print(JsonUtil.loadTrueJson("0")); @@ -1052,7 +1096,7 @@ 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()); + DetailSystemConfig config = configService.getConfigByKey("recommend_search_special_position", acceptData.getChildDetailSystem(), acceptData.getVersion()); if (config == null) { out.print(JsonUtil.loadFalseAdmin("浣嶇疆涓虹┖")); return; -- Gitblit v1.8.0