feat: 完善离线问题

This commit is contained in:
橙子
2023-12-19 16:52:50 +08:00
parent 7766a7b239
commit 6f65ad5255
6 changed files with 6032 additions and 14 deletions

View File

@@ -13,7 +13,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate
public DateTime CreationTime { get; set; }
public int OrderNum { get; set; }
public bool IsDisableCreateDiscuss { get; set; }
}
}

View File

@@ -11,7 +11,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate
public DateTime CreationTime { get; set; }
public int OrderNum { get; set; }
public bool IsDisableCreateDiscuss { get; set; }
}
}

View File

@@ -10,13 +10,13 @@ namespace Yi.Framework.Rbac.Domain.SignalRHubs
{
[HubRoute("/hub/main")]
[Authorize]
public class OnlineUserHub : AbpHub
public class OnlineUserHub : AbpHub
{
public static readonly List<OnlineUserModel> clientUsers = new();
private HttpContext? _httpContext;
private ILogger<OnlineUserHub> _logger=> LoggerFactory.CreateLogger<OnlineUserHub>();
private ILogger<OnlineUserHub> _logger => LoggerFactory.CreateLogger<OnlineUserHub>();
public OnlineUserHub(IHttpContextAccessor httpContextAccessor)
{
_httpContext = httpContextAccessor?.HttpContext;
@@ -68,10 +68,15 @@ namespace Yi.Framework.Rbac.Domain.SignalRHubs
//判断用户是否存在,否则添加集合
if (user != null)
{
clientUsers.Remove(user);
Clients.All.SendAsync("onlineNum", clientUsers.Count);
//Clients.All.SendAsync(HubsConstant.OnlineUser, clientUsers);
_logger.LogInformation($"用户{user?.UserName}离开了,当前已连接{clientUsers.Count}个");
var clientUser = clientUsers.FirstOrDefault(x => x.ConnnectionId == user.ConnnectionId);
if (clientUser is not null)
{
clientUsers.Remove(clientUser);
Clients.All.SendAsync("onlineNum", clientUsers.Count);
//Clients.All.SendAsync(HubsConstant.OnlineUser, clientUsers);
_logger.LogInformation($"用户{user?.UserName}离开了,当前已连接{clientUsers.Count}个");
}
}
return base.OnDisconnectedAsync(exception);
}

File diff suppressed because it is too large Load Diff

View File

@@ -294,12 +294,7 @@ function cancel() {
}
/** 表单重置 */
function reset() {
form.value = {
id: undefined,
title: undefined,
isDeleted: false,
remark: undefined,
};
form.value = {};
proxy.resetForm("dataRef");
}
/** 搜索按钮操作 */

View File

@@ -211,6 +211,8 @@ function cancel() {
/** 表单重置 */
function reset() {
proxy.resetForm("dataRef");
form.value = {
};
}
/** 搜索按钮操作 */
function handleQuery() {
@@ -228,6 +230,7 @@ function handleAdd() {
reset();
open.value = true;
title.value = "添加板块";
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {