diff --git a/AmiyaBotPlayerRatingServer/RealtimeHubs/GameHub.cs b/AmiyaBotPlayerRatingServer/RealtimeHubs/GameHub.cs index 534e287..66890d0 100644 --- a/AmiyaBotPlayerRatingServer/RealtimeHubs/GameHub.cs +++ b/AmiyaBotPlayerRatingServer/RealtimeHubs/GameHub.cs @@ -349,6 +349,12 @@ await Clients.Group(gameId).SendAsync("PlayerLeft", JsonConvert.SerializeObject( }, Game = FormatGame(game), })); + + //如果房主离开了,就关闭房间 + if (game.CreatorId == appUser.Id) + { + await CloseGame(gameId); + } } [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]