admin
2021-02-06 cad915058c3c53bf328a8ae9ca9bc7de099caba7
src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java
@@ -12,6 +12,7 @@
import com.yeshi.buwan.util.ad.CommonAdUtil;
import com.yeshi.buwan.util.annotation.RequireUid;
import com.yeshi.buwan.vo.AcceptData;
import com.yeshi.buwan.vo.HomeClassVO;
import com.yeshi.buwan.vo.video.VideoListResultVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -75,26 +76,26 @@
            }
        }
        if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53) {
            SuperVideoType sty = new SuperVideoType();
            sty.setCreatetime(0 + "");
            sty.setPicture("");
            VideoType vt = new VideoType(22222);
            vt.setName("头条");
            vt.setCategoryType("http://wap.baizhan.net/09");
            vt.setIcon("http://img.zcool.cn/community/01e299592fd75ba8012193a365723f.png@1280w_1l_2o_100sh.png");
            sty.setType(vt);
            boolean isC = false;
            for (SuperVideoType svt : list) {
                if (svt.getType().getId() == vt.getId()) {
                    isC = true;
                    break;
                }
            }
            if (!isC)
                list.add(sty);
        }
//        if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53) {
//            SuperVideoType sty = new SuperVideoType();
//            sty.setCreatetime(0 + "");
//            sty.setPicture("");
//            VideoType vt = new VideoType(22222);
//            vt.setName("头条");
//            vt.setCategoryType("http://wap.baizhan.net/09");
//            vt.setIcon("http://img.zcool.cn/community/01e299592fd75ba8012193a365723f.png@1280w_1l_2o_100sh.png");
//            sty.setType(vt);
//            boolean isC = false;
//            for (SuperVideoType svt : list) {
//                if (svt.getType().getId() == vt.getId()) {
//                    isC = true;
//                    break;
//                }
//            }
//
//            if (!isC)
//                list.add(sty);
//        }
        List<VideoType> typeList = new ArrayList<VideoType>();
        for (int i = 0; i < list.size(); i++) {
@@ -130,35 +131,33 @@
        List<SuperVideoType> list = new ArrayList<>();
        list.addAll(list1);
        if ("huawei".equalsIgnoreCase(acceptData.getChannel())) {
            for (int i = 0; i < list.size(); i++) {
                if (list.get(i).getType().getName().contains("资讯")) {
                    list.remove(i);
                    break;
                }
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getType().getName().contains("资讯")) {
                list.remove(i);
                break;
            }
        }
        if (acceptData.getPlatform().equalsIgnoreCase("android")) {
            for (SuperVideoType type : list) {
                if (type.getType().getName().contains("资讯")) {
                    type.getType().setName("主播");
                    type.getType().setId(1111);
                    type.getType().setIcon("http://img.zcool.cn/community/017fdb57610d8a0000012e7e74b496.png");
                    break;
                }
            }
        }
//        if (acceptData.getPlatform().equalsIgnoreCase("android")) {
//            for (SuperVideoType type : list) {
//                if (type.getType().getName().contains("资讯")) {
//                    type.getType().setName("主播");
//                    type.getType().setId(1111);
//                    type.getType().setIcon("http://img.zcool.cn/community/017fdb57610d8a0000012e7e74b496.png");
//                    break;
//                }
//            }
//        }
        if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53) {
        if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53 && !"qq".equalsIgnoreCase(acceptData.getChannel())) {
            SuperVideoType sty = new SuperVideoType();
            sty.setCreatetime(0 + "");
            sty.setPicture("");
            VideoType vt = new VideoType(22222);
            vt.setName("头条");
            vt.setName("美女直播");
            vt.setShow("1");
            vt.setCategoryType("http://wap.baizhan.net/09");
            vt.setIcon("http://img.zcool.cn/community/01e299592fd75ba8012193a365723f.png@1280w_1l_2o_100sh.png");
            vt.setCategoryType("http://m.v.6.cn/event/porkvideo?src=9n8wc5medm&nologo=1&t=2");
            vt.setIcon("https://hbimg.huabanimg.com/12834704bb4aa39342c2fb51e0c644181b13997b70eb-CqlE1I_fw658/format/webp");
            sty.setType(vt);
            boolean isC = false;
            for (SuperVideoType svt : list) {
@@ -238,6 +237,58 @@
        out.print(JsonUtil.loadTrueJson(object.toString()));
    }
    /**
     * 获取首页导航分类
     *
     * @param acceptData
     * @param request
     * @param out
     */
    public void getHomeClass(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        UserInfo user = userService.getUserInfo(acceptData.getUid());
        if (Utils.isTest(request, user, detailSystem.getId()))
            detailSystem = systemService.getDetailSystemById(40 + "");
        List<SuperVideoType> list = classService.getSuperVideoTypeTitleList(detailSystem.getId());
        List<HomeClassVO> typelist = new ArrayList<>();
        for (SuperVideoType sv : list) {
            VideoType type = sv.getType();
            HomeClassVO vo = new HomeClassVO();
            if ("0".equalsIgnoreCase(type.getShow()))
                vo.setDataType(HomeClassVO.DATA_TYPE_RECOMMEND);
            else
                vo.setDataType(HomeClassVO.DATA_TYPE_CLASS);
            vo.setId(type.getId());
            vo.setName(type.getName());
            vo.setShowTitle(type.getShowTitle());
            vo.setType(type.getType());
            vo.setCategoryType(type.getCategoryType());
            typelist.add(vo);
        }
        HomeClassVO vo = new HomeClassVO();
        vo.setDataType(HomeClassVO.DATA_TYPE_NOVEL);
        vo.setName("小说");
        typelist.add(1, vo);
        JSONObject object = new JSONObject();
        object.put("count", (new StringBuilder(String.valueOf(typelist.size()))).toString());
        JSONArray array = new JSONArray();
        for (int j = 0; j < typelist.size(); j++)
            array.add(StringUtil.outPutResultJson(typelist.get(j)));
        object.put("data", array);
        out.print(JsonUtil.loadTrueJson(object.toString()));
    }
    public void getHotStars(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
@@ -398,6 +449,7 @@
                    }
                    list.add(hv.getVideo());
                }
                count = (new StringBuilder(String.valueOf(homeTypeService.getVideoCountByTypes(homeType, pageIndex))))
                        .toString();
            } else if (!StringUtil.isNullOrEmpty(videoType)) {
@@ -406,7 +458,7 @@
                        Long startTime = System.currentTimeMillis();
                        List<VideoInfo> list1 = classService.getTypeVideoList(videoType, detailSystem, pageIndex, 20,
                                Integer.parseInt(order), resourceList, CacheUtil.getMD5Long(resourceList));
                        list = new ArrayList<VideoInfo>();
                        list = new ArrayList<>();
                        if (list1 != null)
                            for (VideoInfo info : list1)
                                list.add(info);
@@ -415,7 +467,7 @@
                    } else {
                        List<VideoInfo> list1 = classService.getTypeVideoList(videoType, detailSystem, pageIndex, 20, 1,
                                resourceList, CacheUtil.getMD5Long(resourceList));
                        list = new ArrayList<VideoInfo>();
                        list = new ArrayList<>();
                        if (list1 != null)
                            for (VideoInfo info : list1)
                                list.add(info);
@@ -449,7 +501,7 @@
            //缓存数据
            if (list != null && list.size() > 0) {
                redisManager.saveVideoList(key, new VideoListResultVO(list, count));
                redisManager.saveVideoList(key, new VideoListResultVO(list, Long.parseLong(count)));
            }
        }
@@ -705,26 +757,10 @@
    public void getRecommendCategoryVideoList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        String typeid = request.getParameter("Type");
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        // int count =
        // categoryRecommendVideoService.getRankVideoNumber(Integer.parseInt(typeid));
        List<VideoInfo> rankList = categoryRecommendCacheVideoService.getVideoListByRank(Integer.parseInt(typeid),
                detailSystem.getId());
                detailSystem.getId(), acceptData.getPlatform(), acceptData.getVersion());
        List<VideoInfo> list = new ArrayList<VideoInfo>();
        list.addAll(rankList);
        // List<VideoInfo> list1 =
        // recommendService.getCategoryRecommendVideoList(Integer.parseInt(typeid),
        // count);
        // int crvs = list1.size();
        // for (CategoryRecommendCacheVideo crcv : rankList) {
        // int rank = crcv.getRank();
        // if(crvs > 0 && rank > 0 && rank <= crvs ){
        // list1.add(rank-1, crcv.getVideoInfo());
        // }
        // }
        // list.addAll(list1.subList(0, list1.size()>count?count:list1.size()));
        //
        // list = banQuanService.getBanQuanVideo(list, detailSystem.getId(),
        // CacheUtil.getMD5VideoInfo(list));
        for (VideoInfo vi : list) {// 清除无用数据,防止浪费带宽,更改图片
            vi.setIntroduction("");
            vi.setMainActor("");