You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using OMS.NET.DbClass;
|
|
|
|
namespace OMS.NET.Instructs
|
|
{
|
|
public class GetPresenceInstruct : Instruct
|
|
{
|
|
public GetPresenceInstruct()
|
|
{
|
|
this.Type = "get_presence";
|
|
}
|
|
|
|
public override Task Handler(string wsid)
|
|
{
|
|
return Task.Run(() =>
|
|
{
|
|
if (GlobalArea.LoginCheckByID(wsid))
|
|
{
|
|
//获取所有在线用户,移除重复
|
|
List<string?> emails = GlobalArea.UserConnects.Where(u => u.UserEmail != null)
|
|
.Select(u => u.UserEmail).Distinct().ToList();
|
|
List<dynamic> allLoginUsers = new();
|
|
emails.ForEach(email =>
|
|
{
|
|
AccountData accountData = GlobalArea.GetLoginAccountData(email)!;
|
|
//由于是已登录用户,默认都能查询到值
|
|
allLoginUsers.Add(new
|
|
{
|
|
userEmail = accountData.UserEmail,
|
|
userQq = accountData.UserQQ,
|
|
userName = accountData.UserName,
|
|
headColor = accountData.HeadColor,
|
|
});
|
|
});
|
|
this.ResponseOrBroadcastInstructs.Add(new SendPresenceInstruct()
|
|
{
|
|
IsResponse = true,
|
|
Data = allLoginUsers,
|
|
});
|
|
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
public class SendPresenceInstruct : Instruct
|
|
{
|
|
public SendPresenceInstruct()
|
|
{
|
|
this.Type = "send_presence";
|
|
}
|
|
}
|
|
} |