feat: 完善聊天模块
This commit is contained in:
@@ -9,5 +9,8 @@ namespace Yi.Framework.ChatHub.Domain.Shared.Consts
|
||||
public class ChatConst
|
||||
{
|
||||
public const string AllGroupName = "all";
|
||||
|
||||
public const string ClientActionReceiveMsg = "receiveMsg";
|
||||
public const string ClientActionUserStatus = "userStatus";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.ChatHub.Domain.Shared.Model
|
||||
{
|
||||
public class ChatUserModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户id
|
||||
/// </summary>
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名称
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户头像
|
||||
/// </summary>
|
||||
public string UserIcon { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.ChatHub.Domain.Shared.Model
|
||||
{
|
||||
public class MessageContext
|
||||
{
|
||||
public static MessageContext CreatePersonal(string content, Guid userId,Guid sendUserId)
|
||||
{
|
||||
return new MessageContext() { MessageType = MessageType.Personal, Content = content, ReceiveId = userId ,SendUserId= sendUserId };
|
||||
}
|
||||
|
||||
public static MessageContext CreateAll(string content, Guid sendUserId)
|
||||
{
|
||||
return new MessageContext() { MessageType = MessageType.All, Content = content, SendUserId = sendUserId };
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 消息类型
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public MessageType MessageType { get; set; }
|
||||
/// <summary>
|
||||
/// 接收者(用户id、群组id)
|
||||
/// </summary>
|
||||
public Guid? ReceiveId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发送者的用户id
|
||||
/// </summary>
|
||||
public Guid SendUserId { get; set; }
|
||||
/// <summary>
|
||||
/// 消息内容
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public enum MessageType
|
||||
{
|
||||
|
||||
Personal,
|
||||
Group,
|
||||
All
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="Enums\" />
|
||||
<Folder Include="Etos\" />
|
||||
<Folder Include="Model\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user