Jelajahi Sumber

预设助手因isAsistant新逻辑影响order

gemercheung 3 tahun lalu
induk
melakukan
6c744c5546
1 mengubah file dengan 11 tambahan dan 1 penghapusan
  1. 11 1
      src/controller/room/index.js

+ 11 - 1
src/controller/room/index.js

@@ -81,7 +81,7 @@ export class RoomController extends BasicController {
       if (this.user.role === "leader") {
       if (this.user.role === "leader") {
         order = 0;
         order = 0;
       }
       }
-      if (this.user.role === "customer" && Number(this.issAssistant) === 1) {
+      if (this.user.role === "customer" && Number(this.user.issAssistant) === 1) {
         order = 1;
         order = 1;
       }
       }
 
 
@@ -244,6 +244,16 @@ export class RoomController extends BasicController {
           console.log("currentUser.role", user.role);
           console.log("currentUser.role", user.role);
           // 如果踢人后 如何通知?
           // 如果踢人后 如何通知?
           this.socket.broadcast.to(roomId).emit(EVENT.beKicked, data);
           this.socket.broadcast.to(roomId).emit(EVENT.beKicked, data);
+          // 被踢人是助手
+          if (assistantId == data.userId) {
+            const roomConfig = await getRoomConfig(roomId);
+            if (roomConfig.assistantId) {
+              delete roomConfig.assistantId;
+            }
+            await setRoomConfig(roomId, roomConfig);
+          }
+
+          const assistantId = await this.roomAssistant.getRoomAssistant(this.roomId);
 
 
           setTimeout(async () => {
           setTimeout(async () => {
             const isKick = await this.roomAssistant.kickPersion(roomId, userId);
             const isKick = await this.roomAssistant.kickPersion(roomId, userId);