Browse Source

房主进入房间不需要密码验证

develop
杨栋梁 3 years ago
parent
commit
8c9e9e4117
  1. 17
      AX.WebDrillServer/Hubs/FireDeductionHub.cs

17
AX.WebDrillServer/Hubs/FireDeductionHub.cs

@ -126,26 +126,29 @@ namespace AX.WebDrillServer.Hubs
resultData.enterResult = RoomEnterResult.NoUserExist;
return resultData;
}
var roomHas = roomManager.GetRoom(enterInfo.RoomId, enterInfo.Password);
if (roomHas != null)//获取到要进入的房间跟用户信息
if (enterInfo.UserId == room.Owner)//房主免密
{
enterInfo.Password = room.Password;
}
if (enterInfo.Password == room.Password)
{
roomManager.AddUser(user);
user.RoomId = roomHas.RoomId;
user.RoomId = room.RoomId;
RoommateChangeData data = new()
{
ChangeType = RoommateChangeType.Add,
FireDeductionUser = user,
FireDeductionUsers = roomHas.Users
FireDeductionUsers = room.Users
};
//通知web端刷新房间用户列表
await Clients.Group(roomHas.RoomId).SendAsync("callWeb_changeRoomate", data);
await Clients.Group(room.RoomId).SendAsync("callWeb_changeRoomate", data);
resultData.RoomId = roomHas.RoomId;
resultData.RoomId = room.RoomId;
resultData.enterResult = RoomEnterResult.Success;
return resultData;
}
else
{
{//密码错误
resultData.enterResult = RoomEnterResult.RoomError;
return resultData;
}

Loading…
Cancel
Save