admin
2021-12-24 b5e19564dcbf1b7ec12946209d74313479f9dfe1
src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
@@ -13,6 +13,7 @@
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;
@@ -117,6 +118,9 @@
    @Resource
    private DeviceAdStrategyService deviceAdStrategyService;
    @Resource
    private APPManager appManager;
    private final Logger userPlayLogger = LoggerFactory.getLogger("videoPlayUser");
    @RequireUid
@@ -204,8 +208,8 @@
        List<HomeType> list = new ArrayList<>();
        for (HomeType ht : list1)
            list.add(ht);
        if ("309" .equals(vtid)) {
            if (!"ios" .equalsIgnoreCase(acceptData.getPlatform())) {
        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);
@@ -235,7 +239,7 @@
                }
                if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion())) {
                    DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content",  acceptData.getChildDetailSystem(), 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);
@@ -265,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);
@@ -336,7 +340,7 @@
        try {
            if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion()) && dataKey.equalsIgnoreCase("recommend")) {
                DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content",  acceptData.getChildDetailSystem(), 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);
@@ -344,7 +348,7 @@
                    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++;
@@ -647,6 +651,9 @@
        info.setWatchCount("" + (int) (Math.random() * 1000));
        //视频过滤
        filterVideo(acceptData, info);
        JSONArray array = new JSONArray();
        JSONObject obj = new JSONObject();
@@ -657,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("韩国")) {
                //判断当前版本是否正在上线
                if (appManager.isOnline(acceptData.getDetailSystem().getId(), acceptData.getVersion(), acceptData.getChannel())) {
                    //如果在上线就删除未选中的资源,并且将当前资源变为韩迷TV
                    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视频");
                        //在ID前面添加native标识
                        for (VideoDetailInfo videoDetailInfo : video.getVideoDetailList()) {
                            videoDetailInfo.setExtraId("native_" + videoDetailInfo.getExtraId());
                        }
                    }
                }
            }
        }
    }
    @RequireUid
@@ -789,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));
@@ -856,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);
@@ -1036,8 +1074,8 @@
    public void isPraise(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        DetailSystemConfig config = configService.getConfigByKey("banner_praise",  acceptData.getChildDetailSystem(), 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"));
@@ -1058,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",  acceptData.getChildDetailSystem(), acceptData.getVersion());
        DetailSystemConfig config = configService.getConfigByKey("recommend_search_special_position", acceptData.getChildDetailSystem(), acceptData.getVersion());
        if (config == null) {
            out.print(JsonUtil.loadFalseAdmin("位置为空"));
            return;