소스 검색

优化在线消息 在线人数统计

yuhongqi 1 개월 전
부모
커밋
d9eaa6b6a7
1개의 변경된 파일19개의 추가작업 그리고 0개의 파일을 삭제
  1. 19 0
      fs-service-system/src/main/java/com/fs/live/service/impl/LiveWatchUserServiceImpl.java

+ 19 - 0
fs-service-system/src/main/java/com/fs/live/service/impl/LiveWatchUserServiceImpl.java

@@ -278,6 +278,25 @@ public class LiveWatchUserServiceImpl implements ILiveWatchUserService {
     @Override
     public R liveUserTotals(LiveWatchUser liveWatchUser) {
         LiveWatchUserStatistics liveWatchUserStatistics = baseMapper.liveUserTotals(liveWatchUser);
+        if(liveWatchUserStatistics == null)
+        {
+            liveWatchUserStatistics = new LiveWatchUserStatistics();
+            liveWatchUserStatistics.setOnline(0);
+            liveWatchUserStatistics.setOffline(0);
+            liveWatchUserStatistics.setSilenced(0);
+            return R.ok().put("data", liveWatchUserStatistics);
+        }
+        if(liveWatchUserStatistics.getOnline() == null)
+        {
+            liveWatchUserStatistics.setOnline(0);
+        }
+        if (liveWatchUserStatistics.getOffline() == null) {
+            liveWatchUserStatistics.setOffline(0);
+        }
+        if (liveWatchUserStatistics.getSilenced() == null) {
+            liveWatchUserStatistics.setSilenced(0);
+        }
+
         return R.ok().put("data", liveWatchUserStatistics);
     }