|
@@ -28,7 +28,7 @@ export class RoomController extends BasicController {
|
|
role: null,
|
|
role: null,
|
|
userLimitNum: null,
|
|
userLimitNum: null,
|
|
sceneNumber: null,
|
|
sceneNumber: null,
|
|
- roomType: null,
|
|
|
|
|
|
+ // roomType: null,
|
|
from: null,
|
|
from: null,
|
|
onlineStatus: false,
|
|
onlineStatus: false,
|
|
voiceStatus: 0,
|
|
voiceStatus: 0,
|
|
@@ -68,7 +68,7 @@ export class RoomController extends BasicController {
|
|
this.logger.info("init-user-query:", this.socket.handshake.query);
|
|
this.logger.info("init-user-query:", this.socket.handshake.query);
|
|
if (user) {
|
|
if (user) {
|
|
this.user = Object.assign({}, user, {
|
|
this.user = Object.assign({}, user, {
|
|
- roomType: user.roomType || "",
|
|
|
|
|
|
+ // roomType: user.roomType || "",
|
|
});
|
|
});
|
|
this.user.sig = this.getSig(this.user.userId);
|
|
this.user.sig = this.getSig(this.user.userId);
|
|
const oneSceneNum = this.user.sceneNumber || this.user.sceneNum;
|
|
const oneSceneNum = this.user.sceneNumber || this.user.sceneNum;
|
|
@@ -84,14 +84,17 @@ export class RoomController extends BasicController {
|
|
const roomConfig = getRoomConfig(this.roomId);
|
|
const roomConfig = getRoomConfig(this.roomId);
|
|
const checkoutMaster = await isRoomMaster(this.roomId, this.userId);
|
|
const checkoutMaster = await isRoomMaster(this.roomId, this.userId);
|
|
const isNoExistMaster = "masterId" in roomConfig;
|
|
const isNoExistMaster = "masterId" in roomConfig;
|
|
- console.log("checkoutMaster-isNoExistMaster", checkoutMaster, !isNoExistMaster);
|
|
|
|
|
|
+ // console.log("checkoutMaster-isNoExistMaster", checkoutMaster, !isNoExistMaster);
|
|
|
|
|
|
if (checkoutMaster || !isNoExistMaster) {
|
|
if (checkoutMaster || !isNoExistMaster) {
|
|
- await setRoomConfig(this.roomId, {
|
|
|
|
|
|
+ console.log("房主进入记录信息::: checkoutMaster: %s, isNoExistMaster: %s ,roomId %s", checkoutMaster, !isNoExistMaster, this.roomId);
|
|
|
|
+ const roomConfig = {
|
|
masterId: this.userId,
|
|
masterId: this.userId,
|
|
userLimitNum: this.user.userLimitNum,
|
|
userLimitNum: this.user.userLimitNum,
|
|
enableTalk: this.user.enableTalk === "true" ? true : false,
|
|
enableTalk: this.user.enableTalk === "true" ? true : false,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ // console.log("roomConfig", roomConfig);
|
|
|
|
+ await setRoomConfig(this.roomId, roomConfig);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -166,7 +169,7 @@ export class RoomController extends BasicController {
|
|
const roomConfig = await getRoomConfig(this.roomId);
|
|
const roomConfig = await getRoomConfig(this.roomId);
|
|
roomConfig.enableTalk = data;
|
|
roomConfig.enableTalk = data;
|
|
await setRoomConfig(this.roomId, roomConfig);
|
|
await setRoomConfig(this.roomId, roomConfig);
|
|
- console.log("setRoomConfig", data, roomConfig);
|
|
|
|
|
|
+ this.logger.info("changeRoomEnableTalk", JSON.stringify(data));
|
|
this.socket.broadcast.to(this.roomId).emit(EVENT.changeRoomEnableTalk, roomConfig);
|
|
this.socket.broadcast.to(this.roomId).emit(EVENT.changeRoomEnableTalk, roomConfig);
|
|
} catch (error) {
|
|
} catch (error) {
|
|
this.logger.error("event:changeRoomEnableTalk", error);
|
|
this.logger.error("event:changeRoomEnableTalk", error);
|
|
@@ -230,14 +233,24 @@ export class RoomController extends BasicController {
|
|
console.error("error", error);
|
|
console.error("error", error);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 设置助手
|
|
|
|
+ */
|
|
this.socket.on("setAssistant", async ({ data, from }) => {
|
|
this.socket.on("setAssistant", async ({ data, from }) => {
|
|
const userId = `user:${data.userId}`;
|
|
const userId = `user:${data.userId}`;
|
|
const roomId = `room:${data.sceneNumber}:${data.roomId}`;
|
|
const roomId = `room:${data.sceneNumber}:${data.roomId}`;
|
|
console.log("设置助手", userId, roomId);
|
|
console.log("设置助手", userId, roomId);
|
|
|
|
|
|
- this.roomAssistant.setAssistant(roomId, userId);
|
|
|
|
- // this.notify.notifyBeAssistant(roomId, userId, user);
|
|
|
|
|
|
+ this.roomAssistant.setAssistant(roomId, userId, data.cancel);
|
|
|
|
+ });
|
|
|
|
+ /**
|
|
|
|
+ * 设置MIC权
|
|
|
|
+ */
|
|
|
|
+ this.socket.on("setUserhasMic", async ({ data, from, isAllowMic }) => {
|
|
|
|
+ const userId = `user:${data.userId}`;
|
|
|
|
+ const roomId = `room:${data.sceneNumber}:${data.roomId}`;
|
|
|
|
+ console.log("设置MIC权", userId, roomId, data.isAllowMic);
|
|
|
|
+ this.roomAssistant.setMicRight(roomId, userId, data.isAllowMic);
|
|
});
|
|
});
|
|
|
|
|
|
if (this.debugger) {
|
|
if (this.debugger) {
|
|
@@ -266,12 +279,13 @@ export class RoomController extends BasicController {
|
|
roomId: this.user.roomId,
|
|
roomId: this.user.roomId,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- setTimeout(() => {
|
|
|
|
- this.socket.emit("someOneInRoom", {
|
|
|
|
- user: this.user,
|
|
|
|
- roomsPerson: AllRoomUsers,
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ //TODO someOneInRoom是用来触发语音与更新房间状态
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ // this.socket.emit("someOneInRoom", {
|
|
|
|
+ // user: this.user,
|
|
|
|
+ // roomsPerson: AllRoomUsers,
|
|
|
|
+ // });
|
|
|
|
+ // });
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
this.logger.error("room::roomMasterAutoRejoin", error);
|
|
this.logger.error("room::roomMasterAutoRejoin", error);
|