| | |
| | | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.video.VideoWatchHistory; |
| | | import com.yeshi.buwan.service.imp.AttentionService; |
| | | import com.yeshi.buwan.service.imp.CollectionService; |
| | | import com.yeshi.buwan.service.imp.VideoService; |
| | | import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; |
| | | import com.yeshi.buwan.util.Constant; |
| | |
| | | @Resource |
| | | private VideoService videoService; |
| | | |
| | | @Resource |
| | | private CollectionService collectionService; |
| | | |
| | | @Resource |
| | | private AttentionService attentionService; |
| | | |
| | | public void getWatchHistory(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | int page = Integer.parseInt(request.getParameter("Page")); |
| | |
| | | Map<String, VideoInfo> videoInfoMap = new HashMap<>(); |
| | | if (videoInfoList != null) |
| | | for (VideoInfo vi : videoInfoList) { |
| | | videoInfoMap.put(vi.getId(), vi); |
| | | if (vi != null) |
| | | videoInfoMap.put(vi.getId(), vi); |
| | | } |
| | | for (VideoWatchHistory wh : list) { |
| | | wh.setVideo(videoInfoMap.get(wh.getVideoId())); |
| | |
| | | out.print(JsonUtil.loadTrueJson("")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户视频数据数量信息 |
| | | * |
| | | * @param acceptData |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | public void getUserVideoDataCount(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJson("用户未登录")); |
| | | return; |
| | | } |
| | | |
| | | long collectionCount = collectionService.getCollectVideoCount(acceptData.getUid()); |
| | | long attentionCount = attentionService.getAttentionCountByLoginUid(Long.parseLong(loginUid)); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("collectionCount", collectionCount); |
| | | data.put("attentionCount", attentionCount); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } |
| | | |
| | | } |