前端:
1、优化消息排序逻辑 2、新增加载历史消息 3、修复已知问题 后端: 1、优化消息排序逻辑 2、增加用户信息缓存机制 3、修改日期类型为DateTimeOffset改善时区信息丢失问题 3、修复了已知问题 数据库: 1、新增SequenceId字段用于消息排序 2、新增ClientMsgId字段用于客户端消息回执
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
using IM_API.Dtos.User;
|
||||
|
||||
namespace IM_API.Dtos.Auth
|
||||
{
|
||||
public class LoginDto
|
||||
{
|
||||
public UserInfoDto userInfo { get; set; }
|
||||
public string Token { get; set; }
|
||||
public string RefreshToken { get; set; }
|
||||
public DateTime ExpireAt { get; set; }
|
||||
public LoginDto(UserInfoDto userInfo,string token, string refreshToken, DateTime expireAt) {
|
||||
this.userInfo = userInfo;
|
||||
Token = token;
|
||||
RefreshToken = refreshToken;
|
||||
ExpireAt = expireAt;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using IM_API.Models;
|
||||
|
||||
namespace IM_API.Dtos.Conversation
|
||||
{
|
||||
public class ConversationDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户
|
||||
/// </summary>
|
||||
public int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对方ID(群聊为群聊ID,单聊为单聊ID)
|
||||
/// </summary>
|
||||
public int TargetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后一条未读消息ID
|
||||
/// </summary>
|
||||
public int? LastReadMessageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 未读消息数
|
||||
/// </summary>
|
||||
public int UnreadCount { get; set; }
|
||||
|
||||
public int ChatType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 最后一条最新消息
|
||||
/// </summary>
|
||||
public string LastMessage { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// 最后一条消息时间
|
||||
/// </summary>
|
||||
public DateTime? DateTime { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// 对方昵称
|
||||
/// </summary>
|
||||
public string TargetName { get; set; }
|
||||
/// <summary>
|
||||
/// 对方头像
|
||||
/// </summary>
|
||||
public string? TargetAvatar { get; set; }
|
||||
public MessageBaseDto? LastReadMessage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace IM_API.Dtos.Conversation
|
||||
{
|
||||
public class UpdateConversationDto
|
||||
{
|
||||
public string StreamKey { get; set; }
|
||||
public int SenderId { get; set; }
|
||||
public int ReceiptId { get; set; }
|
||||
public string LastMessage { get; set; }
|
||||
public long LastSequenceId { get; set; }
|
||||
public DateTimeOffset DateTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace IM_API.Dtos.Friend
|
||||
|
||||
public FriendStatus StatusEnum { get; init; }
|
||||
|
||||
public DateTime Created { get; init; }
|
||||
public DateTimeOffset Created { get; init; }
|
||||
|
||||
public string RemarkName { get; init; } = string.Empty;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace IM_API.Dtos.Friend
|
||||
/// <summary>
|
||||
/// 申请时间
|
||||
/// </summary>
|
||||
public DateTime Created { get; set; }
|
||||
public DateTimeOffset Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请附言
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using IM_API.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace IM_API.Dtos.Group
|
||||
{
|
||||
@@ -7,11 +8,15 @@ namespace IM_API.Dtos.Group
|
||||
/// <summary>
|
||||
/// 群聊名称
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "群名称必填")]
|
||||
[MaxLength(20, ErrorMessage = "群名称不能大于20字符")]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 群头像
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "群头像必填")]
|
||||
public string Avatar { get; set; } = null!;
|
||||
public List<int>? UserIDs { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace IM_API.Dtos.Group
|
||||
/// <summary>
|
||||
/// 群聊创建时间
|
||||
/// </summary>
|
||||
public DateTime Created { get; set; }
|
||||
public DateTimeOffset Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 群头像
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace IM_API.Dtos
|
||||
Code = CodeDefine.SUCCESS.Code;
|
||||
Message = CodeDefine.SUCCESS.Message;
|
||||
Type = HubResponseType.ActionStatus;
|
||||
Method = method;
|
||||
}
|
||||
public HubResponse(string method,T data)
|
||||
{
|
||||
@@ -21,6 +22,7 @@ namespace IM_API.Dtos
|
||||
Message = CodeDefine.SUCCESS.Message;
|
||||
Type = HubResponseType.ActionStatus;
|
||||
Data = data;
|
||||
Method = method;
|
||||
}
|
||||
public HubResponse(CodeDefine codedefine,string method)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace IM_API.Dtos.Message
|
||||
{
|
||||
public class MessageQueryDto
|
||||
{
|
||||
[Required(ErrorMessage = "会话ID必填")]
|
||||
public int ConversationId { get; set; }
|
||||
|
||||
// 锚点序号(如果为空,说明是第一次进聊天框,拉最新的)
|
||||
public long? Cursor { get; set; }
|
||||
|
||||
// 查询方向:0 - 查旧(Before), 1 - 查新(After)
|
||||
public int Direction { get; set; } = 0;
|
||||
|
||||
public int Limit { get; set; } = 20;
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,11 @@ namespace IM_API.Dtos
|
||||
// 使用 { get; init; } 确保对象创建后不可修改,且支持无参构造
|
||||
public MessageMsgType Type { get; init; } = default!;
|
||||
public ChatType ChatType { get; init; } = default!;
|
||||
public string? MsgId { get; init; }
|
||||
public Guid MsgId { get; init; }
|
||||
public int SenderId { get; init; }
|
||||
public int ReceiverId { get; init; }
|
||||
public int? GroupMemberId { get; init; }
|
||||
public string Content { get; init; } = default!;
|
||||
public DateTime TimeStamp { get; init; }
|
||||
public DateTimeOffset TimeStamp { get; init; }
|
||||
public MessageBaseDto() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace IM_API.Dtos.User
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime Created { get; set; }
|
||||
public DateTimeOffset Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账户状态
|
||||
|
||||
Reference in New Issue
Block a user