| | |
| | | import com.yeshi.buwan.util.log.UserActiveLogFactory; |
| | | import com.yeshi.buwan.util.log.VideoLogFactory; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.video.VideoDetailVO; |
| | | import com.yeshi.buwan.youku.YouKuUtil; |
| | | import com.yeshi.buwan.youku.entity.YouKuSearchVideoMap; |
| | | import com.yeshi.buwan.youku.entity.YouKuShowDetail; |
| | |
| | | JSONObject object = new JSONObject(); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | List<HomeType> list1 = homeTypeService.getHomeType(detailSystem.getId(), resourceList, |
| | | 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<>(); |
| | | for (HomeType ht : list1) |
| | |
| | | type.setVideoList(vlist); |
| | | return type; |
| | | } |
| | | |
| | | |
| | | // 首页类型获取 |
| | | public void getHomeVideoList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | // 20170914 一级视频分类ID |
| | | String homeTypeId = request.getParameter("Id"); |
| | | int page = Integer.parseInt(request.getParameter("Page")); |
| | | |
| | | if (StringUtil.isNullOrEmpty(homeTypeId)) { |
| | | out.print(JsonUtil.loadFalseJson("")); |
| | | return; |
| | | } |
| | | |
| | | HomeType homeType = homeTypeService.getHomeTypeById(homeTypeId); |
| | | if (homeType == null) { |
| | | out.print(JsonUtil.loadFalseJson("")); |
| | | return; |
| | | } |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | //查询大图 |
| | | List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, resourceList, true, page, homeType.getNumber()); |
| | | |
| | | |
| | | //大图需要每次都返回 |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | |
| | | Long count = homeTypeService.getHomeVideoListCount(homeTypeId, resourceList, null); |
| | | List<HomeVideo> list1 = homeTypeService.getHomeVideoList(homeTypeId, resourceList, false, page, homeType.getNumber()); |
| | | List<HomeVideo> list = new ArrayList<>(); |
| | | list.addAll(bigPictureVideos); |
| | | list.addAll(list1); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < list.size(); i++) |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | object.put("list", array); |
| | | |
| | | //判断是否还有下一页 |
| | | int totalPage = (int) ((count - bigPictureVideos.size()) % homeType.getNumber() == 0 ? (count - bigPictureVideos.size()) / homeType.getNumber() : (count - bigPictureVideos.size()) / homeType.getNumber() + 1); |
| | | |
| | | if (page >= totalPage) { |
| | | page = 0; |
| | | } |
| | | data.put("page", page); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | } |
| | | |
| | | |
| | | @RequireUid |
| | | public void getMoreVideo(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | JSONObject obj = new JSONObject(); |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), |
| | | obj.toString())); |
| | | |
| | | if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), new VideoDetailVO.VideoAdInfo(true, false), null)), array.toString(), |
| | | obj.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), |
| | | obj.toString())); |
| | | } |
| | | } |
| | | |
| | | @RequireUid |
| | |
| | | info.setCommentCount((int) count); |
| | | |
| | | JSONObject obj = new JSONObject(); |
| | | VideoDetailVO.AttentionInfo attention = null; |
| | | if (info.getVideoDetailList() != null) |
| | | if (info.getVideoDetailList().size() > 1) {// 多集,可关注 |
| | | boolean isAttention = false; |
| | | if (!StringUtil.isNullOrEmpty(loginUid)) { |
| | | isAttention = attentionService.isAddAttention(loginUid, info.getId()); |
| | | } |
| | | attention = new VideoDetailVO.AttentionInfo(); |
| | | attention.setName(info.getName()); |
| | | attention.setPicture(info.getPicture()); |
| | | if (StringUtil.isNullOrEmpty(info.getUpdatetime())) { |
| | | attention.setUpdateInfo("更新:" + TimeUtil.getCommentTime(info.getCreatetime())); |
| | | } else { |
| | | attention.setUpdateInfo("更新:" + TimeUtil.getCommentTime(Long.parseLong(info.getUpdatetime()))); |
| | | } |
| | | attention.setAttention(isAttention); |
| | | |
| | | //兼容老版本 |
| | | JSONObject attentionInfo = new JSONObject(); |
| | | attentionInfo.put("Name", info.getName()); |
| | | attentionInfo.put("Picture", info.getPicture()); |
| | | if (StringUtil.isNullOrEmpty(info.getUpdatetime())) |
| | | attentionInfo.put("UpdateInfo", "更新:" + TimeUtil.getCommentTime(info.getCreatetime())); |
| | | else |
| | | attentionInfo.put("UpdateInfo", "更新:" + TimeUtil.getCommentTime(Long.parseLong(info.getUpdatetime()))); |
| | | attentionInfo.put("IsAttention", isAttention); |
| | | attentionInfo.put("Picture", attention.getPicture()); |
| | | attentionInfo.put("Name", attention.getName()); |
| | | attentionInfo.put("UpdateInfo", attention.getUpdateInfo()); |
| | | attentionInfo.put("IsAttention", attention.isAttention()); |
| | | obj.put("Attention", attentionInfo); |
| | | } |
| | | UserInfo user = userService.getUserInfo(acceptData.getUid()); |
| | | if (Utils.isTest(request, user, detailSystem.getId())) |
| | | out.print(JsonUtil.loadTrueJson("")); |
| | | else |
| | | if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), new VideoDetailVO.VideoAdInfo(true, true), attention)), array.toString(), |
| | | obj.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), |
| | | obj.toString())); |
| | | } |
| | | } |
| | | |
| | | |