From f788607ff771a47bc60d6a86e00b3433c40f3d2c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 24 九月 2021 15:22:03 +0800
Subject: [PATCH] 接入视频直播

---
 src/main/java/com/yeshi/buwan/controller/parser/UserVideoParser.java |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/controller/parser/UserVideoParser.java b/src/main/java/com/yeshi/buwan/controller/parser/UserVideoParser.java
index 43fd1c5..1bfad36 100644
--- a/src/main/java/com/yeshi/buwan/controller/parser/UserVideoParser.java
+++ b/src/main/java/com/yeshi/buwan/controller/parser/UserVideoParser.java
@@ -2,6 +2,8 @@
 
 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;
@@ -29,6 +31,12 @@
     @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"));
@@ -46,7 +54,8 @@
         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()));
@@ -72,4 +81,28 @@
         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()));
+    }
+
 }

--
Gitblit v1.8.0