前端:
1、优化消息排序逻辑 2、新增加载历史消息 3、修复已知问题 后端: 1、优化消息排序逻辑 2、增加用户信息缓存机制 3、修改日期类型为DateTimeOffset改善时区信息丢失问题 3、修复了已知问题 数据库: 1、新增SequenceId字段用于消息排序 2、新增ClientMsgId字段用于客户端消息回执
This commit is contained in:
@@ -8,6 +8,10 @@ using IM_API.Services;
|
||||
using IM_API.Tools;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RedLockNet;
|
||||
using RedLockNet.SERedis;
|
||||
using RedLockNet.SERedis.Configuration;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace IM_API.Configs
|
||||
{
|
||||
@@ -17,14 +21,23 @@ namespace IM_API.Configs
|
||||
{
|
||||
|
||||
services.AddAutoMapper(typeof(MapperConfig));
|
||||
services.AddTransient<IAuthService, AuthService>();
|
||||
services.AddTransient<IUserService, UserService>();
|
||||
services.AddTransient<IFriendSerivce, FriendService>();
|
||||
services.AddTransient<IMessageSevice, MessageService>();
|
||||
services.AddTransient<IConversationService, ConversationService>();
|
||||
services.AddScoped<IAuthService, AuthService>();
|
||||
services.AddScoped<IUserService, UserService>();
|
||||
services.AddScoped<IFriendSerivce, FriendService>();
|
||||
services.AddScoped<IMessageSevice, MessageService>();
|
||||
services.AddScoped<IConversationService, ConversationService>();
|
||||
services.AddScoped<IGroupService, GroupService>();
|
||||
services.AddScoped<ISequenceIdService, SequenceIdService>();
|
||||
services.AddScoped<ICacheService, RedisCacheService>();
|
||||
services.AddScoped<IEventBus, InMemoryEventBus>();
|
||||
services.AddSingleton<IJWTService, JWTService>();
|
||||
services.AddSingleton<IRefreshTokenService, RedisRefreshTokenService>();
|
||||
services.AddSingleton<IDistributedLockFactory>(sp =>
|
||||
{
|
||||
var connection = sp.GetRequiredService<IConnectionMultiplexer>();
|
||||
// 这里可以配置多个 Redis 节点提高安全性,单机运行传一个即可
|
||||
return RedLockFactory.Create(new List<RedLockMultiplexer> { new RedLockMultiplexer(connection) });
|
||||
});
|
||||
return services;
|
||||
}
|
||||
public static IServiceCollection AddModelValidation(this IServiceCollection services, IConfiguration configuration)
|
||||
@@ -40,7 +53,7 @@ namespace IM_API.Configs
|
||||
Field = e.Key,
|
||||
Message = e.Value.Errors.First().ErrorMessage
|
||||
});
|
||||
|
||||
Console.WriteLine(errors);
|
||||
return new BadRequestObjectResult(new BaseResponse<object?>(CodeDefine.PARAMETER_ERROR.Code, errors.First().Message));
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user