admin
2021-07-30 a66b556036c2b3936a51fd7b7e54a204eb31dc14
src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
@@ -41,6 +41,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.videos.bilibili.BilibiliUtil;
import com.yeshi.buwan.vo.AcceptData;
import com.yeshi.buwan.vo.video.VideoDetailVO;
import com.yeshi.buwan.youku.YouKuUtil;
@@ -199,7 +200,7 @@
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        JSONObject object = new JSONObject();
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion());
        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<>();
@@ -306,7 +307,7 @@
        long count = homeTypeService.countHomeType(acceptData.getDetailSystem().getId(), acceptData.getVersion(), dataKey);
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion());
        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)
@@ -329,7 +330,7 @@
                homeType.setCount((int) videoCount);
                List<HomeVideo> tempHomeVideoList = new ArrayList<>();
                tempHomeVideoList.addAll(homeVideoList);
                while (tempHomeVideoList != null && (tempHomeVideoList.size() - bigPictureCount) % homeType.getColumns() != 0)
                while (tempHomeVideoList != null && tempHomeVideoList.size() > 0 && (tempHomeVideoList.size() - bigPictureCount) % homeType.getColumns() != 0)
                    tempHomeVideoList.remove(tempHomeVideoList.size() - 1);
                homeType.setHomeVideoList(tempHomeVideoList);
@@ -397,7 +398,7 @@
            return;
        }
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion());
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel());
        //查询大图
        List<HomeVideo> bigPictureVideos = new ArrayList<>();
@@ -522,6 +523,9 @@
    private TencentVideoUtil tencentVideoUtil;
    @Resource
    private BilibiliUtil bilibiliUtil;
    @Resource
    private VideoPlayStatisticManager videoPlayStatisticManager;
@@ -584,6 +588,14 @@
        } else if (Integer.parseInt(resourceId) == TencentVideoUtil.RESOURCE_ID) {
            try {
                info = tencentVideoUtil.getVideoInfo(internetSearchVideo, pageSize);
            } catch (Exception e) {
                logger.error("全网搜视频详情出错:" + videoId);
                out.print(JsonUtil.loadFalseAdmin(e.getMessage()));
                return;
            }
        } else if (Integer.parseInt(resourceId) == BilibiliUtil.RESOURCE_ID) {
            try {
                info = bilibiliUtil.getVideoInfo(internetSearchVideo, pageSize);
            } catch (Exception e) {
                logger.error("全网搜视频详情出错:" + videoId);
                out.print(JsonUtil.loadFalseAdmin(e.getMessage()));
@@ -660,7 +672,7 @@
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion());
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel());
        //获取优先展示的渠道
        if (StringUtil.isNullOrEmpty(resourceId)) {
@@ -735,10 +747,8 @@
            ThreadUtil.run(new Runnable() {
                @Override
                public void run() {
                    //每天展示一次广告
                    long showTime = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd");
                    deviceAdStrategyService.setVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), showTime, null);
                    //看PP视频
                    deviceAdStrategyService.watchPPTVVideo(acceptData.getUtdId(), acceptData.getDetailSystem().getId());
                }
            });
            return;
@@ -800,12 +810,20 @@
        if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion())) {
            String sessionId = createVideoDetailSessionId(acceptData, loginUid, info.getName(), videoId, resourceId);
            out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), deviceAdStrategyService.getVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), loginUid,videoId,from), attention, sessionId)), array.toString(),
            out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), deviceAdStrategyService.getVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), loginUid, videoId, from), attention, sessionId)), array.toString(),
                    obj.toString()));
        } else {
            out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(),
                    obj.toString()));
        }
        ThreadUtil.run(new Runnable() {
            @Override
            public void run() {
                long showTime = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd");
                deviceAdStrategyService.setShortVideoAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), videoId, from, showTime, null);
            }
        });
    }