前端:
1、优化消息排序逻辑 2、新增加载历史消息 3、修复已知问题 后端: 1、优化消息排序逻辑 2、增加用户信息缓存机制 3、修改日期类型为DateTimeOffset改善时区信息丢失问题 3、修复了已知问题 数据库: 1、新增SequenceId字段用于消息排序 2、新增ClientMsgId字段用于客户端消息回执
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
using IM_API.Configs;
|
||||
using IM_API.Configs.Options;
|
||||
using IM_API.Filters;
|
||||
using IM_API.Hubs;
|
||||
using IM_API.Models;
|
||||
@@ -25,18 +26,22 @@ namespace IM_API
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.Build();
|
||||
string conStr = configuration.GetConnectionString("DefaultConnection")!;
|
||||
string redisConStr = configuration.GetConnectionString("Redis");
|
||||
var conOptions = configuration.GetSection("ConnectionStrings").Get<ConnectionOptions>();
|
||||
//注入数据库上下文
|
||||
builder.Services.AddDbContext<ImContext>(options =>
|
||||
{
|
||||
options.UseMySql(conStr,ServerVersion.AutoDetect(conStr));
|
||||
options.UseMySql(conOptions.DefaultConnection,ServerVersion.AutoDetect(conOptions.DefaultConnection));
|
||||
});
|
||||
//注入redis
|
||||
var redis = ConnectionMultiplexer.Connect(redisConStr);
|
||||
var redis = ConnectionMultiplexer.Connect(conOptions.Redis);
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redis);
|
||||
|
||||
builder.Services.AddRabbitMQ(configuration.GetSection("RabbitMqOptions").Get<RabbitMqOptions>());
|
||||
builder.Services.AddStackExchangeRedisCache(options =>
|
||||
{
|
||||
options.ConnectionMultiplexerFactory = () => Task.FromResult<IConnectionMultiplexer>(redis);
|
||||
});
|
||||
|
||||
builder.Services.AddRabbitMQ(configuration.GetSection("RabbitMqOptions").Get<RabbitMQOptions>());
|
||||
|
||||
builder.Services.AddAllService(configuration);
|
||||
|
||||
@@ -116,7 +121,7 @@ namespace IM_API
|
||||
}).AddJsonOptions(options =>
|
||||
{
|
||||
// 保持 ISO 8601 格式
|
||||
options.JsonSerializerOptions.Converters.Add(new UtcDateTimeConverter());
|
||||
//options.JsonSerializerOptions.Converters.Add(new UtcDateTimeConverter());
|
||||
// 将枚举转换为字符串
|
||||
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
|
||||
// 建议:保持驼峰命名
|
||||
|
||||
Reference in New Issue
Block a user