|
@@ -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;
|
|
@@ -58,7 +58,8 @@ export class RoomService {
|
|
|
|
|
|
async handleUserOffline(socket: Socket) {
|
|
|
await this._sleep(500);
|
|
|
- if (socket.data?.user) {
|
|
|
+ // banning 离线过滤通知
|
|
|
+ if (socket.data?.user && !socket.data.banning) {
|
|
|
this.delayService.handleOffline(socket);
|
|
|
const { RoomId, UserId, Role } = socket.data.user;
|
|
|
await this.userService.setRoomEntranceLog(RoomId, UserId, 1);
|
|
@@ -136,6 +137,7 @@ export class RoomService {
|
|
|
// console.log('isMaxRoom', isMax);
|
|
|
if (isMax && Role !== 'leader' && !isExist) {
|
|
|
this.logger.warn(`308:room-maxing`, 'join-error');
|
|
|
+ socket.data.banning = true;
|
|
|
socket.emit('manager-error', {
|
|
|
type: 'room-maxing',
|
|
|
code: 308,
|
|
@@ -147,6 +149,7 @@ export class RoomService {
|
|
|
if (!blockJoin) {
|
|
|
if (!isExist) {
|
|
|
await this.userService.insertUser(socket.data.user);
|
|
|
+ socket.data.banning = false;
|
|
|
} else {
|
|
|
const updated = await this.userService.updateUsers(socket.data.user);
|
|
|
if (!updated) {
|
|
@@ -158,6 +161,7 @@ export class RoomService {
|
|
|
`same userId in room not matchRole `,
|
|
|
'join-error',
|
|
|
);
|
|
|
+ socket.data.banning = true;
|
|
|
socket.disconnect(true);
|
|
|
return;
|
|
|
}
|