|
@@ -832,6 +832,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
userState.forEach(user -> {
|
|
|
log.info("opsRoom>>>> {}", JSONObject.toJSONString(user));
|
|
|
if (StringUtils.isBlank(user.getStatus())) {
|
|
|
+ log.debug("opsRoom>>>> user status is null");
|
|
|
return;
|
|
|
}
|
|
|
Date now = new Date();
|
|
@@ -843,12 +844,14 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
//缓存的时间比当前传入时间大则放弃这条数据
|
|
|
long cacheTime = userStateTimeCache.get();
|
|
|
if (cacheTime > userStateTime) {
|
|
|
+ log.debug("opsRoom>>>> cacheTime > userStateTime, cacheTime: {}, userStateTime: {}", cacheTime, userStateTime);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
//获取当前用户所在房间的uid
|
|
|
RBucket<String> userRoom = redissonClient.getBucket(LIVE_USER_ROOM.replace(USER_ID, userid));
|
|
|
if (!userRoom.isExists()) {
|
|
|
+ log.debug("opsRoom>>>> userRoom is not exists, userState: {}", JSON.toJSONString(userState));
|
|
|
return;
|
|
|
}
|
|
|
String roomUid = userRoom.get();
|
|
@@ -878,9 +881,6 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
//这里开始只处理观看者的数据,观看者只接受退出消息 status=0 是进入房间
|
|
|
if (user.getStatus().equals("0")) {
|
|
|
|
|
|
- // 用户进入直播间,发送统计数据
|
|
|
- sendLiveRoomStatMessage(userid, roomVo);
|
|
|
-
|
|
|
// 更新用户在线状态
|
|
|
liveBroadcastRoomMemberService.lambdaUpdate()
|
|
|
.eq(ImLiveBroadcastRoomMember::getTenantId, roomVo.getTenantId())
|
|
@@ -889,6 +889,10 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
.set(ImLiveBroadcastRoomMember::getOnlineStatus, 1)
|
|
|
.update();
|
|
|
|
|
|
+
|
|
|
+ // 用户进入直播间,发送统计数据
|
|
|
+ sendLiveRoomStatMessage(userid, roomVo);
|
|
|
+ log.debug("opsRoom>>>> user enter room, userState: {}", JSON.toJSONString(userState));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -896,9 +900,11 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
RMap<Integer, String> roomTotalUser = this.getTotalUserCache(roomUid);
|
|
|
//该房间未查询到用户数据则不处理
|
|
|
if (!roomTotalUser.isExists()) {
|
|
|
+ log.debug("opsRoom>>>> roomTotalUser is not exists, userState: {}", JSON.toJSONString(userState));
|
|
|
return;
|
|
|
}
|
|
|
if (!roomTotalUser.containsKey(userId)) {
|
|
|
+ log.debug("opsRoom>>>> roomTotalUser is not containsKey, userState: {}", JSON.toJSONString(userState));
|
|
|
return;
|
|
|
}
|
|
|
String userJsonStr = roomTotalUser.get(userId);
|
|
@@ -914,6 +920,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
//查询在线人员列表
|
|
|
RMap<Integer, String> onlineUserInfo = this.getOnlineUserCache(roomUid);
|
|
|
if (!onlineUserInfo.isExists()) {
|
|
|
+ log.debug("opsRoom>>>> onlineUserInfo is not exists, userState: {}", JSON.toJSONString(userState));
|
|
|
return;
|
|
|
}
|
|
|
//从在线人员列表删除该人员
|
|
@@ -960,6 +967,10 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
// 直播间统计数据
|
|
|
getRoomData(roomVo);
|
|
|
|
|
|
+ // 设置群组属性
|
|
|
+ setGroupDefinedData(roomVo,EGroupDefinedDataType.MEMBER_ONLINE,roomVo.getLookNum().toString());
|
|
|
+ setGroupDefinedData(roomVo,EGroupDefinedDataType.MEMBER_TOTAL,roomVo.getTotalLookNum().toString());
|
|
|
+
|
|
|
// 消息发送用户
|
|
|
LiveRoomMessage.MessageUser messageUser = null;
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
@@ -1272,6 +1283,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
.groupId(roomVo.getRoomUid())
|
|
|
.appDefinedData(appDefinedData)
|
|
|
.build());
|
|
|
+ log.debug("设置直播群配置成功 roomUid:{}, data {}",roomVo.getRoomUid(), JSONObject.toJSONString(appDefinedData));
|
|
|
} catch (Exception e) {
|
|
|
log.error("设置直播群配置失败", e);
|
|
|
}
|