Browse Source

增加已设置的重进

gemercheung 2 years ago
parent
commit
2af93f290b
2 changed files with 7 additions and 4 deletions
  1. 2 3
      src/room/actions/actions.service.ts
  2. 5 1
      src/room/room.service.ts

+ 2 - 3
src/room/actions/actions.service.ts

@@ -48,8 +48,8 @@ export class ActionsService {
     }
     this.roomService.logger.warn(`当前-socket-是否助手::${assistant}`);
     this.roomService.logger.warn(
-      `当前--broadcast:${roomId}, data:${JSON.stringify(data)}action:${data.type
-      } ,isLeader:${isSocketLeader()}`,
+      `当前--broadcast:${roomId}, data:${JSON.stringify(data)}action:
+      ${data.type} ,isLeader:${isSocketLeader()}`,
       'handleAllAction',
     );
     switch (data.type) {
@@ -65,7 +65,6 @@ export class ActionsService {
       case 'users-muted':
         const mutedParams = data as any as MutedStateType;
         mutedParams.roomId = roomId;
-
         if (isSocketLeader() || assistant) {
           await this.handleMutedState(mutedParams);
         }

+ 5 - 1
src/room/room.service.ts

@@ -17,7 +17,7 @@ export class RoomService {
     private readonly actionsService: ActionsService,
     private readonly delayService: DelayService,
     private readonly tempService: TempService,
-  ) {}
+  ) { }
   public readonly logger = new Logger('user');
   public _sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
   public _userInfo = {} as UserInfoType;
@@ -104,6 +104,10 @@ export class RoomService {
     userInfo: UserInfoParams,
   ): Promise<void> {
     const user = this.initUserProfile(userInfo);
+    const exist = await this.userService.getUsersBy(user.RoomId, user.UserId);
+    if ('IsAssistant' in exist) {
+      user.IsAssistant = exist.IsAssistant;
+    }
     this._userInfo = user;
     socket.data.user = user;
     socket.data.user.roomConfig = userInfo.roomConfig;