feat: 对接chathub用户列表

This commit is contained in:
橙子
2024-04-04 19:28:18 +08:00
parent b57d56f317
commit 43b4032bbb
16 changed files with 302 additions and 16 deletions

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.ChatHub.Domain.Shared.Caches
{
public class ChatOnlineUserCacheItem
{
public ChatOnlineUserCacheItem()
{
}
/// <summary>
/// 用户id
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public string UserIcon { get; set; }
/// <summary>
/// 客户端id
/// </summary>
public string ClientId { get; set; }
/// <summary>
/// 连接时间
/// </summary>
public DateTime CreationTime { get; }=DateTime.Now;
public override string ToString()
{
return System.Text.Json.JsonSerializer.Serialize(this);
}
}
public class ChatOnlineUserCacheKey
{
public string CacheKeyPrefix;
public ChatOnlineUserCacheKey(string cacheKeyPrefix )
{
CacheKeyPrefix=cacheKeyPrefix;
}
public string GetKey()
{
return $"{CacheKeyPrefix}ChatOnline";
}
public string GetField(Guid userId)
{
return $"{userId}";
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.ChatHub.Domain.Shared.Consts
{
public class ChatConst
{
public const string AllGroupName = "all";
}
}

View File

@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<ItemGroup>
<Folder Include="Caches\" />
<Folder Include="Consts\" />
<Folder Include="Enums\" />
<Folder Include="Etos\" />
<Folder Include="Model\" />
@@ -10,5 +8,6 @@
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain.Shared" Version="$(AbpVersion)" />
</ItemGroup>
</Project>