Browse Source

非直播不进行弹窗

yuhongqi 17 hours ago
parent
commit
be3772fa23

+ 6 - 6
fs-live-app/src/main/java/com/fs/live/websocket/service/WebSocketServer.java

@@ -362,7 +362,11 @@ public class WebSocketServer {
                             if (currentLive == null) {
                                 break;
                             }
-                            
+                            Map<String, Integer> liveFlagWithCache = liveWatchUserService.getLiveFlagWithCache(currentLive.getLiveId());
+                            if(1 != liveFlagWithCache.get("liveFlag")) {
+                                break;
+                            }
+
                             // 判断直播是否已开始:status=2(直播中) 或 当前时间 >= 开播时间
                             boolean isLiveStarted = false;
                             if (currentLive.getStatus() != null && currentLive.getStatus() == 2) {
@@ -375,13 +379,9 @@ public class WebSocketServer {
                             }
                             
                             if (!isLiveStarted) {
-                                log.debug("[心跳-观看时长] 直播未开始(开播倒计时中),不统计观看时长, liveId={}, status={}, startTime={}", 
-                                        liveId, currentLive.getStatus(), currentLive.getStartTime());
                                 break;
                             }
-                            
-                            log.debug("[心跳-观看时长] 直播已开始,统计观看时长, liveId={}, userId={}, duration={}秒", 
-                                    liveId, watchUserId, currentDuration);
+
                             
                             // 使用Hash结构存储:一个直播间一个Hash,包含所有用户的时长
                             String hashKey = "live:watch:duration:hash:" + liveId;