|
@@ -2,6 +2,7 @@
|
|
|
import { EVENT, CODEMEG, FROMTYPE } from "../../enum/index.js";
|
|
import { EVENT, CODEMEG, FROMTYPE } from "../../enum/index.js";
|
|
|
import { getCurrentUser, updateUser, removeRoomAllUsers, getAllRoomUsers, updateRoomUser, removeRoomUser } from "../../service/userService.js";
|
|
import { getCurrentUser, updateUser, removeRoomAllUsers, getAllRoomUsers, updateRoomUser, removeRoomUser } from "../../service/userService.js";
|
|
|
import { setRoomConfig, getRoomConfig, isRoomMaster } from "../../service/roomConfigService.js";
|
|
import { setRoomConfig, getRoomConfig, isRoomMaster } from "../../service/roomConfigService.js";
|
|
|
|
|
+import { createMessage } from "../../service/msgService.js";
|
|
|
import { subClient } from "../../connection/redis.js";
|
|
import { subClient } from "../../connection/redis.js";
|
|
|
|
|
|
|
|
const prefix = process.env.REDIS_PREFIX || "chat";
|
|
const prefix = process.env.REDIS_PREFIX || "chat";
|
|
@@ -335,7 +336,7 @@ export class RoomAssistant {
|
|
|
if (checkIsRoomMaster) {
|
|
if (checkIsRoomMaster) {
|
|
|
this.room.logger.info("房主已存在房间 :", { roomId, userId, from: user.from });
|
|
this.room.logger.info("房主已存在房间 :", { roomId, userId, from: user.from });
|
|
|
await this.joinRoom(roomId, userId, user);
|
|
await this.joinRoom(roomId, userId, user);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// this.notifyUserJitter(roomId);
|
|
// this.notifyUserJitter(roomId);
|
|
|
} else {
|
|
} else {
|
|
|
this.room.logger.error("存在非法房主", roomId, userId);
|
|
this.room.logger.error("存在非法房主", roomId, userId);
|
|
@@ -470,6 +471,14 @@ export class RoomAssistant {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 记录房间内MSG
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+ async sendMessage(roomId, user, msg) {
|
|
|
|
|
+ await createMessage(roomId, user, msg);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 主动断开
|
|
// 主动断开
|
|
|
async disconnect() {
|
|
async disconnect() {
|
|
|
try {
|
|
try {
|