|
@@ -364,7 +364,7 @@ public class RoomServiceImpl extends ServiceImpl<IRoomMapper, Room> implements I
|
|
|
roomVisitLogService.addLog(roomId,roomUserId,userId,type);
|
|
|
}
|
|
|
if(type == 1 ){ //离开房间
|
|
|
- //this.stopRoom(roomId,roomUserId);
|
|
|
+ this.stopRoom(roomId,roomUserId,1);
|
|
|
roomVisitLogService.addLog(roomId,roomUserId,userId,type);
|
|
|
}
|
|
|
room.setLastLookTime(DateUtil.formatDateTime(new Date()));
|
|
@@ -386,27 +386,29 @@ public class RoomServiceImpl extends ServiceImpl<IRoomMapper, Room> implements I
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void stopRoom(String roomId,Integer roomUserId) {
|
|
|
+ public void stopRoom(String roomId,Integer roomUserId,Integer roomStatus) {
|
|
|
if(roomUserId == null){
|
|
|
- LambdaUpdateWrapper<Room> wrapper = new LambdaUpdateWrapper<>();
|
|
|
- wrapper.eq(Room::getRoomId,roomId);
|
|
|
- wrapper.set(Room::getRoomStatus,2);
|
|
|
- this.update(wrapper);
|
|
|
+ if(roomStatus == 2){
|
|
|
+ LambdaUpdateWrapper<Room> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(Room::getRoomId,roomId);
|
|
|
+ wrapper.set(Room::getRoomStatus,roomStatus);
|
|
|
+ this.update(wrapper);
|
|
|
+
|
|
|
+ List<RoomUser> byRoomId = roomUserService.getByRoomId(roomId);
|
|
|
+ for (RoomUser roomUser : byRoomId) {
|
|
|
+ roomUserService.stopRoom(roomUser,roomStatus);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
roomVisitLogService.stopRoom(roomId,roomUserId);
|
|
|
roomDanmakuService.saveDanMaku(roomId,roomUserId);
|
|
|
-
|
|
|
- List<RoomUser> byRoomId = roomUserService.getByRoomId(roomId);
|
|
|
- for (RoomUser roomUser : byRoomId) {
|
|
|
- roomUserService.stopRoom(roomUser);
|
|
|
- }
|
|
|
}else {
|
|
|
RoomUser roomUser = roomUserService.getById(roomUserId);
|
|
|
if(roomUser != null){
|
|
|
- roomUserService.stopRoom(roomUser);
|
|
|
+ roomUserService.stopRoom(roomUser,roomStatus);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|