gemercheung 3 роки тому
батько
коміт
6bacbce93d
1 змінених файлів з 8 додано та 8 видалено
  1. 8 8
      src/controller/room/assistant.js

+ 8 - 8
src/controller/room/assistant.js

@@ -160,7 +160,7 @@ export class RoomAssistant {
 
   async removeRoom(roomId) {
     this.room.logger.info("removeRoom", { roomId });
-    await this.redis.del(roomId);
+    await this.redis.del(getInKey(roomId));
   }
 
   /**
@@ -250,7 +250,7 @@ export class RoomAssistant {
         this.room.logger.info("不是房主", JSON.stringify(user));
         await this.joinRoom(roomId, userId, user);
       } else {
-        const hasRoom = await this.redis.hVals(roomId);
+        const hasRoom = await this.redis.hVals(getInKey(roomId));
         if (hasRoom.length === 0) {
           this.room.logger.info("房主主动创建房间 :", { roomId, userId });
           await this.buildRoom(roomId, userId, user);
@@ -339,18 +339,18 @@ export class RoomAssistant {
     const userId = this.room.userId;
     this.socket.leave(syncId);
     this.socket.leave(roomId);
-    await this.redis.del(syncId);
-    await this.redis.del(userId);
+    await this.redis.del(getInKey(syncId));
+    await this.redis.del(getInKey(userId));
   }
   // RoomSessionId 房间有效时间
   setRoomUnlimit(roomSessionId) {
-    return this.redis.expire(roomSessionId, -1);
+    return this.redis.expire(getInKey(roomSessionId), -1);
   }
-  setRoomAvailableBySeconds(roomSessionId, seconds) {
-    return this.redis.expire(roomSessionId, seconds);
+  setRoomAvailableBySeconds(getInKey(roomSessionId), seconds) {
+    return this.redis.expire(getInKey(roomSessionId), seconds);
   }
   setRoomAvailableByHours(roomSessionId, hours) {
-    return this.redis.expire(roomSessionId, 60 * 60 * hours);
+    return this.redis.expire(getInKey(roomSessionId), 60 * 60 * hours);
   }
   watchRoomExpired(callback) {
     subClient.subscribe("__keyevent@0__:expired", this.watchRoomExpiredFn);