gemercheung 3 년 전
부모
커밋
0740f89d3b
2개의 변경된 파일5개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 2
      src/controller/room/assistant.js
  2. 4 4
      src/controller/room/index.js

+ 1 - 2
src/controller/room/assistant.js

@@ -116,8 +116,7 @@ export class RoomAssistant {
 
   async getRoomAssistant(roomId) {
     const roomConfig = await getRoomConfig(roomId);
-    const config = JSON.parse(roomConfig);
-    const assistantId = config.assistantId || "";
+    const assistantId = roomConfig.assistantId || "";
     return Promise.resolve(assistantId);
   }
   /**

+ 4 - 4
src/controller/room/index.js

@@ -88,14 +88,14 @@ export class RoomController extends BasicController {
           order = 2;
           break;
       }
+
+      const userObj = { ...this.user, onlineStatus: 1, isConnected: true, order };
       const assistantId = this.roomAssistant.getRoomAssistant(this.roomId);
-      if (assistantId && this.userId !== assistantId) {
-        this.logger.info("已存在用户并不是该用户:", this.user.role);
+      if (assistantId && this.userId !== assistantId && !this.isHoster(this.user.role)) {
+        this.logger.info("已存在用户并不是该用户:", this.user);
         userObj.role = "customer";
       }
-      const userObj = { ...this.user, onlineStatus: 1, isConnected: true, order };
       this.logger.info("update-user-info:", userObj);
-
       updateUser(this.userId, userObj);
       // this.sysUsers.push(this.user);
       // 只有来源于小程序用户信息才记录到redis