feat: 完成后端消息推送用户信息

This commit is contained in:
陈淳
2024-04-08 18:57:59 +08:00
parent 586775c8ff
commit 641217085f
7 changed files with 156 additions and 39 deletions

View File

@@ -5,14 +5,15 @@ using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Yi.Framework.ChatHub.Domain.Shared.Enums;
using Yi.Framework.Rbac.Domain.Shared.Dtos;
namespace Yi.Framework.ChatHub.Domain.Shared.Model
{
public class MessageContext
{
public static MessageContext CreatePersonal(string content, Guid userId,Guid sendUserId)
public static MessageContext CreatePersonal(string content, Guid userId, Guid sendUserId)
{
return new MessageContext() { MessageType = MessageTypeEnum.Personal, Content = content, ReceiveId = userId ,SendUserId= sendUserId };
return new MessageContext() { MessageType = MessageTypeEnum.Personal, Content = content, ReceiveId = userId, SendUserId = sendUserId };
}
public static MessageContext CreateAll(string content, Guid sendUserId)
@@ -20,7 +21,12 @@ namespace Yi.Framework.ChatHub.Domain.Shared.Model
return new MessageContext() { MessageType = MessageTypeEnum.All, Content = content, SendUserId = sendUserId };
}
public void SetUserInfo(UserRoleMenuDto sendUserInfo, UserRoleMenuDto? receiveInfo)
{
this.SendUserInfo = sendUserInfo;
this.ReceiveInfo = receiveInfo;
}
/// <summary>
/// 消息类型
/// </summary>
@@ -31,15 +37,25 @@ namespace Yi.Framework.ChatHub.Domain.Shared.Model
/// </summary>
public Guid? ReceiveId { get; set; }
/// <summary>
/// 接收者用户信息
/// </summary>
public UserRoleMenuDto? ReceiveInfo { get; set; }
/// <summary>
/// 发送者的用户id
/// </summary>
public Guid SendUserId { get; set; }
/// <summary>
/// 发送者用户信息
/// </summary>
public UserRoleMenuDto SendUserInfo { get; set; }
/// <summary>
/// 消息内容
/// </summary>
public string Content { get; set; }
public DateTime CreationTime { get;protected set; }=DateTime.Now;
public DateTime CreationTime { get; protected set; } = DateTime.Now;
}