登录claim增加昵称,signalr去除不必要的消息

This commit is contained in:
YUN-PC5\user 2023-09-25 10:38:11 +08:00
parent ee9f6bacf3
commit cacb525b3a
2 changed files with 3 additions and 2 deletions

View File

@ -34,6 +34,7 @@ namespace Infrastructure.Model
{ {
UserId = info.UserId; UserId = info.UserId;
UserName = info.UserName; UserName = info.UserName;
NickName = info.NickName;
DeptId = info.DeptId; DeptId = info.DeptId;
Roles = roles; Roles = roles;
RoleIds = roles.Select(f => f.RoleKey).ToList(); RoleIds = roles.Select(f => f.RoleKey).ToList();

View File

@ -69,7 +69,7 @@ namespace ZR.ServiceCore.Signalr
Log.WriteLine(msg: $"{name},{Context.ConnectionId}连接服务端success当前已连接{onlineClients.Count}个"); Log.WriteLine(msg: $"{name},{Context.ConnectionId}连接服务端success当前已连接{onlineClients.Count}个");
//Clients.All.SendAsync("welcome", $"欢迎您:{name},当前时间:{DateTime.Now}"); //Clients.All.SendAsync("welcome", $"欢迎您:{name},当前时间:{DateTime.Now}");
Clients.Caller.SendAsync(HubsConstant.MoreNotice, SendNotice()); Clients.Caller.SendAsync(HubsConstant.MoreNotice, SendNotice());
Clients.Caller.SendAsync(HubsConstant.ConnId, onlineUser.ConnnectionId); // Clients.Caller.SendAsync(HubsConstant.ConnId, onlineUser.ConnnectionId);
} }
OnlineUsers userInfo = GetUserById(userid); OnlineUsers userInfo = GetUserById(userid);
if (userInfo == null) if (userInfo == null)
@ -91,7 +91,7 @@ namespace ZR.ServiceCore.Signalr
var connIds = onlineClients.Where(f => f.Userid == userid).ToList(); var connIds = onlineClients.Where(f => f.Userid == userid).ToList();
userInfo.ClientNum = connIds.Count; userInfo.ClientNum = connIds.Count;
Clients.Clients(connIds.Select(f => f.ConnnectionId)).SendAsync("onlineInfo", userInfo); // Clients.Clients(connIds.Select(f => f.ConnnectionId)).SendAsync("onlineInfo", userInfo);
Log.WriteLine(ConsoleColor.Blue, msg: $"用户{name}已连接,今日已在线{userInfo?.TodayOnlineTime}分钟,当前已连接{onlineClients.Count}个"); Log.WriteLine(ConsoleColor.Blue, msg: $"用户{name}已连接,今日已在线{userInfo?.TodayOnlineTime}分钟,当前已连接{onlineClients.Count}个");
//给所有用户更新在线人数 //给所有用户更新在线人数