gemercheung 2 vuotta sitten
vanhempi
commit
9b85ab00bb
2 muutettua tiedostoa jossa 21 lisäystä ja 2 poistoa
  1. 20 1
      src/room-manager/room-manager.controller.ts
  2. 1 1
      src/room/room.service.ts

+ 20 - 1
src/room-manager/room-manager.controller.ts

@@ -20,7 +20,7 @@ export class RoomManagerController {
     private readonly roomManagerService: RoomManagerService,
     private readonly roomService: RoomService,
     private readonly usersService: UsersService,
-  ) {}
+  ) { }
 
   @Get('/danmaku/:id')
   @ApiOperation({ summary: '获取房间弹幕列表' })
@@ -36,8 +36,27 @@ export class RoomManagerController {
     type: DanmakuDto,
   })
   findDanmakuList(@Param('id') id: string) {
+    this.roomService.logger.log(`roomId: ${id}`, 'api-room-danmaku');
     return this.roomManagerService.findDanmakuList(id);
   }
+  @Get('/danmaku/delete/:id')
+  @ApiOperation({ summary: '删除房间弹幕列表' })
+  @ApiParam({
+    name: 'id',
+    required: true,
+    description: '房间ID',
+    schema: { oneOf: [{ type: 'string' }] },
+    type: 'string',
+  })
+  @ApiResponse({
+    description: 'The record has been successfully created.',
+    type: DanmakuDto,
+  })
+  async deleteDanmakuList(@Param('id') id: string) {
+    this.roomService.logger.log(`roomId: ${id}`, 'api-room-del-danmaku');
+    const res = await this.usersService.delRoomMsgs(id);
+    return res;
+  }
 
   @Get('/dismissRoom/:id')
   @ApiOperation({ summary: '主动解散房间' })

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

@@ -322,7 +322,7 @@ export class RoomService {
   async handleRoomDismiss(RoomId: string): Promise<boolean> {
     await this.userService.delRoom(RoomId);
     await this.userService.delRoomConfig(RoomId);
-    await this.userService.delRoomMsgs(RoomId);
+    // await this.userService.delRoomMsgs(RoomId);
     this.socketGateway.server
       .to(RoomId)
       .emit('action', { type: 'leader-dismiss' });