|
@@ -98,6 +98,10 @@ export class RoomController extends BasicController {
|
|
|
// this.logger.info("已存在默认助手变更:" + "room助手ID: " + assistantId + " userId: " + this.user.userId);
|
|
|
// }
|
|
|
}
|
|
|
+ //检查房间人数
|
|
|
+ const res = await this.roomAssistant.checkRoomMaximum(roomId);
|
|
|
+ console.log("checkRoomMaximum:", res);
|
|
|
+ this.roomAssistant.roomMax = res.isMax;
|
|
|
|
|
|
// if (assistantId && Number(this.userId) !== Number(assistantId) && !this.isHoster(this.user.role)) {
|
|
|
// userObj.role = "customer";
|
|
@@ -220,19 +224,21 @@ export class RoomController extends BasicController {
|
|
|
|
|
|
this.socket.on(EVENT.changeOnlineStatus, async (data) => {
|
|
|
try {
|
|
|
- const user = await this.currentUser();
|
|
|
- user.onlineStatus = Number(data.status);
|
|
|
- await updateRoomUser(this.roomId, this.userId, user);
|
|
|
- this.user = user;
|
|
|
- //更新一份
|
|
|
- let actionName = Number(user.onlineStatus) === 1 ? "inRoom" : "leaveRoom";
|
|
|
- this.logger.info("changeOnlineStatus", JSON.stringify(user));
|
|
|
- const AllRoomUsers = await getAllRoomUsers(this.roomId);
|
|
|
- this.socket.broadcast.to(this.roomId).emit(EVENT.roomPersonChange, {
|
|
|
- roomsPerson: AllRoomUsers,
|
|
|
- actionName,
|
|
|
- user: user,
|
|
|
- });
|
|
|
+ if (!this.roomAssistant.roomMax) {
|
|
|
+ const user = await this.currentUser();
|
|
|
+ user.onlineStatus = Number(data.status);
|
|
|
+ await updateRoomUser(this.roomId, this.userId, user);
|
|
|
+ this.user = user;
|
|
|
+ //更新一份
|
|
|
+ let actionName = Number(user.onlineStatus) === 1 ? "inRoom" : "leaveRoom";
|
|
|
+ this.logger.info("changeOnlineStatus", JSON.stringify(user));
|
|
|
+ const AllRoomUsers = await getAllRoomUsers(this.roomId);
|
|
|
+ this.socket.broadcast.to(this.roomId).emit(EVENT.roomPersonChange, {
|
|
|
+ roomsPerson: AllRoomUsers,
|
|
|
+ actionName,
|
|
|
+ user: user,
|
|
|
+ });
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
this.logger.error("event:changeOnlineStatus", error);
|
|
|
}
|