111
This commit is contained in:
parent
ac22e5097c
commit
9a7c0c61d0
|
|
@ -110,12 +110,12 @@ namespace WGShare.API.Controllers.Frontend
|
||||||
var users = RedisHelper.Instance.HVals<ChannelUserInfo>(RedisKeyConstant.SessionManage.GetChannelUserKey(TenantId, inputDTO.RoomNum));
|
var users = RedisHelper.Instance.HVals<ChannelUserInfo>(RedisKeyConstant.SessionManage.GetChannelUserKey(TenantId, inputDTO.RoomNum));
|
||||||
var showUser = users.FirstOrDefault(x => x.RoleId == ((int)RoleEnums.Admin).ToString() || x.IsRoomManager || x.RoleId == ((int)RoleEnums.RoomManager).ToString());
|
var showUser = users.FirstOrDefault(x => x.RoleId == ((int)RoleEnums.Admin).ToString() || x.IsRoomManager || x.RoleId == ((int)RoleEnums.RoomManager).ToString());
|
||||||
if (showUser != null)
|
if (showUser != null)
|
||||||
{
|
{
|
||||||
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), inputDTO.RoomNum, showUser.UID);
|
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), inputDTO.RoomNum, showUser.UID);
|
||||||
await _hubContext.Clients.Group(inputDTO.RoomNum).ShowUser(showUser.UID, showUser.UserName, string.Empty, string.Empty);
|
await _hubContext.Clients.Group(inputDTO.RoomNum).ShowUser(showUser.UID, showUser.UserName, string.Empty, string.Empty);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), inputDTO.RoomNum, 0);
|
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), inputDTO.RoomNum, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +124,7 @@ namespace WGShare.API.Controllers.Frontend
|
||||||
// 取消显示用户,设置显示当前操作的管理员
|
// 取消显示用户,设置显示当前操作的管理员
|
||||||
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), inputDTO.RoomNum, UId);
|
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), inputDTO.RoomNum, UId);
|
||||||
await _hubContext.Clients.Group(inputDTO.RoomNum).ShowUser(UId, UserName, string.Empty, string.Empty);
|
await _hubContext.Clients.Group(inputDTO.RoomNum).ShowUser(UId, UserName, string.Empty, string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await _hubContext.Clients.Group(inputDTO.RoomNum).ManagerRefresh(user, UId);
|
await _hubContext.Clients.Group(inputDTO.RoomNum).ManagerRefresh(user, UId);
|
||||||
|
|
@ -396,6 +396,12 @@ namespace WGShare.API.Controllers.Frontend
|
||||||
[HttpPost("show-user")]
|
[HttpPost("show-user")]
|
||||||
public async Task SetShowUser([FromQuery] string roomNum, [FromQuery] string uid, [FromQuery] string uname)
|
public async Task SetShowUser([FromQuery] string roomNum, [FromQuery] string uid, [FromQuery] string uname)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (RedisHelper.Instance.HGet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), roomNum) == uid)
|
||||||
|
{
|
||||||
|
// 如果已经是全员观看他了,则不做处理
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 设置房间全员观看用户
|
// 设置房间全员观看用户
|
||||||
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), roomNum, uid);
|
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), roomNum, uid);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace WGShare.API.Hubs
|
||||||
|
|
||||||
Console.WriteLine($"{DateTime.Now}连接成功 当前租户:{tenant} account:{account} uid:{uid} connectId:{Context.ConnectionId}");
|
Console.WriteLine($"{DateTime.Now}连接成功 当前租户:{tenant} account:{account} uid:{uid} connectId:{Context.ConnectionId}");
|
||||||
|
|
||||||
await ClearUserChannel(uid, tenant, account, ssid, false);
|
//await ClearUserChannel(uid, tenant, account, ssid, false);
|
||||||
// 存储在线信息
|
// 存储在线信息
|
||||||
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetOnlineUserKey(tenant), uid, Context.ConnectionId);
|
RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetOnlineUserKey(tenant), uid, Context.ConnectionId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue