From cad915058c3c53bf328a8ae9ca9bc7de099caba7 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 06 二月 2021 15:27:49 +0800 Subject: [PATCH] 接口bug修改 --- src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java | 126 +++++++++++++++++++++++++++-------------- 1 files changed, 82 insertions(+), 44 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java b/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java index 20cde2c..20f2dc7 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java +++ b/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++) { @@ -148,15 +149,15 @@ // } // } - 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) { @@ -236,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) { @@ -396,6 +449,7 @@ } list.add(hv.getVideo()); } + count = (new StringBuilder(String.valueOf(homeTypeService.getVideoCountByTypes(homeType, pageIndex)))) .toString(); } else if (!StringUtil.isNullOrEmpty(videoType)) { @@ -404,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); @@ -413,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); @@ -447,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))); } } @@ -703,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(""); -- Gitblit v1.8.0