Merge branch 'feature-nxdev' of https://gitea.nxsir.cn/code/IM into feature-nxdev

This commit is contained in:
西街长安 2026-01-28 18:27:08 +08:00
commit e65eeb5ff7
44 changed files with 815 additions and 251 deletions

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("IMTest")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f41e7137fed96054a894ffa374b72ab6dd4a0b6a")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e05497a478c4bb77e993819051ad8d2ff581fa93")]
[assembly: System.Reflection.AssemblyProductAttribute("IMTest")]
[assembly: System.Reflection.AssemblyTitleAttribute("IMTest")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
3c907fc092e5da2dde7386b239ed7e37568883ede28dc96f41506aa4c8b81601
f196a285ecd82a93a930d3cf15e8440cf7ade1451ba42ad34469a54bf70670bc

View File

@ -155,6 +155,10 @@
"target": "Package",
"version": "[12.0.0, )"
},
"MassTransit.RabbitMQ": {
"target": "Package",
"version": "[8.5.5, )"
},
"Microsoft.AspNetCore.Authentication.JwtBearer": {
"target": "Package",
"version": "[8.0.21, )"

View File

@ -53,6 +53,57 @@
"build/netstandard1.0/coverlet.collector.targets": {}
}
},
"MassTransit/8.5.5": {
"type": "package",
"dependencies": {
"MassTransit.Abstractions": "8.5.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
"Microsoft.Extensions.Diagnostics.HealthChecks": "8.0.0",
"Microsoft.Extensions.Hosting.Abstractions": "8.0.0",
"Microsoft.Extensions.Logging.Abstractions": "8.0.0",
"Microsoft.Extensions.Options": "8.0.0"
},
"compile": {
"lib/net8.0/MassTransit.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/MassTransit.dll": {
"related": ".xml"
}
}
},
"MassTransit.Abstractions/8.5.5": {
"type": "package",
"compile": {
"lib/net8.0/MassTransit.Abstractions.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/MassTransit.Abstractions.dll": {
"related": ".xml"
}
}
},
"MassTransit.RabbitMQ/8.5.5": {
"type": "package",
"dependencies": {
"MassTransit": "8.5.5",
"RabbitMQ.Client": "7.1.2"
},
"compile": {
"lib/net8.0/MassTransit.RabbitMqTransport.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/MassTransit.RabbitMqTransport.dll": {
"related": ".xml"
}
}
},
"Microsoft.AspNetCore.Authentication.Abstractions/2.3.0": {
"type": "package",
"dependencies": {
@ -664,6 +715,38 @@
"buildTransitive/net6.0/_._": {}
}
},
"Microsoft.Extensions.Diagnostics.HealthChecks/8.0.0": {
"type": "package",
"dependencies": {
"Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions": "8.0.0",
"Microsoft.Extensions.Hosting.Abstractions": "8.0.0",
"Microsoft.Extensions.Logging.Abstractions": "8.0.0",
"Microsoft.Extensions.Options": "8.0.0"
},
"compile": {
"lib/net8.0/Microsoft.Extensions.Diagnostics.HealthChecks.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.Diagnostics.HealthChecks.dll": {
"related": ".xml"
}
}
},
"Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions/8.0.0": {
"type": "package",
"compile": {
"lib/net8.0/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll": {
"related": ".xml"
}
}
},
"Microsoft.Extensions.FileProviders.Abstractions/8.0.0": {
"type": "package",
"dependencies": {
@ -1360,6 +1443,23 @@
}
}
},
"RabbitMQ.Client/7.1.2": {
"type": "package",
"dependencies": {
"System.IO.Pipelines": "8.0.0",
"System.Threading.RateLimiting": "8.0.0"
},
"compile": {
"lib/net8.0/RabbitMQ.Client.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/RabbitMQ.Client.dll": {
"related": ".xml"
}
}
},
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {
"type": "package",
"runtimeTargets": {
@ -2655,6 +2755,22 @@
"buildTransitive/net6.0/_._": {}
}
},
"System.Threading.RateLimiting/8.0.0": {
"type": "package",
"compile": {
"lib/net8.0/System.Threading.RateLimiting.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/System.Threading.RateLimiting.dll": {
"related": ".xml"
}
},
"build": {
"buildTransitive/net6.0/_._": {}
}
},
"System.Threading.Tasks/4.3.0": {
"type": "package",
"dependencies": {
@ -2859,6 +2975,7 @@
"dependencies": {
"AutoMapper": "12.0.1",
"AutoMapper.Extensions.Microsoft.DependencyInjection": "12.0.0",
"MassTransit.RabbitMQ": "8.5.5",
"Microsoft.AspNetCore.Authentication.JwtBearer": "8.0.21",
"Microsoft.AspNetCore.SignalR": "1.2.0",
"Microsoft.VisualStudio.Azure.Containers.Tools.Targets": "1.22.1",
@ -2987,6 +3104,69 @@
"coverlet.collector.nuspec"
]
},
"MassTransit/8.5.5": {
"sha512": "bSg8k5q+rP1s+dIGXLLbctqDGdIkfDjdxwNWtCUH7xNCN9ZuM7mqSPQPIFgaYIi34e81m4FqAqo4CAHuWPkhRA==",
"type": "package",
"path": "masstransit/8.5.5",
"files": [
".nupkg.metadata",
".signature.p7s",
"NuGet.README.md",
"lib/net472/MassTransit.dll",
"lib/net472/MassTransit.xml",
"lib/net8.0/MassTransit.dll",
"lib/net8.0/MassTransit.xml",
"lib/net9.0/MassTransit.dll",
"lib/net9.0/MassTransit.xml",
"lib/netstandard2.0/MassTransit.dll",
"lib/netstandard2.0/MassTransit.xml",
"masstransit.8.5.5.nupkg.sha512",
"masstransit.nuspec",
"mt-logo-small.png"
]
},
"MassTransit.Abstractions/8.5.5": {
"sha512": "0mn2Ay17dD6z5tgSLjbVRlldSbL9iowzFEfVgVfBXVG5ttz9dSWeR4TrdD6pqH93GWXp4CvSmF8i1HqxLX7DZw==",
"type": "package",
"path": "masstransit.abstractions/8.5.5",
"files": [
".nupkg.metadata",
".signature.p7s",
"NuGet.README.md",
"lib/net472/MassTransit.Abstractions.dll",
"lib/net472/MassTransit.Abstractions.xml",
"lib/net8.0/MassTransit.Abstractions.dll",
"lib/net8.0/MassTransit.Abstractions.xml",
"lib/net9.0/MassTransit.Abstractions.dll",
"lib/net9.0/MassTransit.Abstractions.xml",
"lib/netstandard2.0/MassTransit.Abstractions.dll",
"lib/netstandard2.0/MassTransit.Abstractions.xml",
"masstransit.abstractions.8.5.5.nupkg.sha512",
"masstransit.abstractions.nuspec",
"mt-logo-small.png"
]
},
"MassTransit.RabbitMQ/8.5.5": {
"sha512": "UxWn4o90YVMF9PBkJeoskOFPneh6YtnI1fLJHtvZiSAG0eoiRrWPGa+6FQCvjkQ/ljCKfjzok2eGZc/vmNZ01A==",
"type": "package",
"path": "masstransit.rabbitmq/8.5.5",
"files": [
".nupkg.metadata",
".signature.p7s",
"NuGet.README.md",
"lib/net472/MassTransit.RabbitMqTransport.dll",
"lib/net472/MassTransit.RabbitMqTransport.xml",
"lib/net8.0/MassTransit.RabbitMqTransport.dll",
"lib/net8.0/MassTransit.RabbitMqTransport.xml",
"lib/net9.0/MassTransit.RabbitMqTransport.dll",
"lib/net9.0/MassTransit.RabbitMqTransport.xml",
"lib/netstandard2.0/MassTransit.RabbitMqTransport.dll",
"lib/netstandard2.0/MassTransit.RabbitMqTransport.xml",
"masstransit.rabbitmq.8.5.5.nupkg.sha512",
"masstransit.rabbitmq.nuspec",
"mt-logo-small.png"
]
},
"Microsoft.AspNetCore.Authentication.Abstractions/2.3.0": {
"sha512": "ve6uvLwKNRkfnO/QeN9M8eUJ49lCnWv/6/9p6iTEuiI6Rtsz+myaBAjdMzLuTViQY032xbTF5AdZF5BJzJJyXQ==",
"type": "package",
@ -3887,6 +4067,44 @@
"useSharedDesignerContext.txt"
]
},
"Microsoft.Extensions.Diagnostics.HealthChecks/8.0.0": {
"sha512": "P9SoBuVZhJPpALZmSq72aQEb9ryP67EdquaCZGXGrrcASTNHYdrUhnpgSwIipgM5oVC+dKpRXg5zxobmF9xr5g==",
"type": "package",
"path": "microsoft.extensions.diagnostics.healthchecks/8.0.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"THIRD-PARTY-NOTICES.TXT",
"lib/net462/Microsoft.Extensions.Diagnostics.HealthChecks.dll",
"lib/net462/Microsoft.Extensions.Diagnostics.HealthChecks.xml",
"lib/net8.0/Microsoft.Extensions.Diagnostics.HealthChecks.dll",
"lib/net8.0/Microsoft.Extensions.Diagnostics.HealthChecks.xml",
"lib/netstandard2.0/Microsoft.Extensions.Diagnostics.HealthChecks.dll",
"lib/netstandard2.0/Microsoft.Extensions.Diagnostics.HealthChecks.xml",
"microsoft.extensions.diagnostics.healthchecks.8.0.0.nupkg.sha512",
"microsoft.extensions.diagnostics.healthchecks.nuspec"
]
},
"Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions/8.0.0": {
"sha512": "AT2qqos3IgI09ok36Qag9T8bb6kHJ3uT9Q5ki6CySybFsK6/9JbvQAgAHf1pVEjST0/N4JaFaCbm40R5edffwg==",
"type": "package",
"path": "microsoft.extensions.diagnostics.healthchecks.abstractions/8.0.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"THIRD-PARTY-NOTICES.TXT",
"lib/net462/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll",
"lib/net462/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.xml",
"lib/net8.0/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll",
"lib/net8.0/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.xml",
"lib/netstandard2.0/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll",
"lib/netstandard2.0/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.xml",
"microsoft.extensions.diagnostics.healthchecks.abstractions.8.0.0.nupkg.sha512",
"microsoft.extensions.diagnostics.healthchecks.abstractions.nuspec"
]
},
"Microsoft.Extensions.FileProviders.Abstractions/8.0.0": {
"sha512": "ZbaMlhJlpisjuWbvXr4LdAst/1XxH3vZ6A0BsgTphZ2L4PGuxRLz7Jr/S7mkAAnOn78Vu0fKhEgNF5JO3zfjqQ==",
"type": "package",
@ -4801,6 +5019,23 @@
"pomelo.entityframeworkcore.mysql.nuspec"
]
},
"RabbitMQ.Client/7.1.2": {
"sha512": "y3c6ulgULScWthHw5PLM1ShHRLhxg0vCtzX/hh61gRgNecL3ZC3WoBW2HYHoXOVRqTl99Br9E7CZEytGZEsCyQ==",
"type": "package",
"path": "rabbitmq.client/7.1.2",
"files": [
".nupkg.metadata",
".signature.p7s",
"README.md",
"icon.png",
"lib/net8.0/RabbitMQ.Client.dll",
"lib/net8.0/RabbitMQ.Client.xml",
"lib/netstandard2.0/RabbitMQ.Client.dll",
"lib/netstandard2.0/RabbitMQ.Client.xml",
"rabbitmq.client.7.1.2.nupkg.sha512",
"rabbitmq.client.nuspec"
]
},
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {
"sha512": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==",
"type": "package",
@ -8051,6 +8286,35 @@
"useSharedDesignerContext.txt"
]
},
"System.Threading.RateLimiting/8.0.0": {
"sha512": "7mu9v0QDv66ar3DpGSZHg9NuNcxDaaAcnMULuZlaTpP9+hwXhrxNGsF5GmLkSHxFdb5bBc1TzeujsRgTrPWi+Q==",
"type": "package",
"path": "system.threading.ratelimiting/8.0.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"buildTransitive/net461/System.Threading.RateLimiting.targets",
"buildTransitive/net462/_._",
"buildTransitive/net6.0/_._",
"buildTransitive/netcoreapp2.0/System.Threading.RateLimiting.targets",
"lib/net462/System.Threading.RateLimiting.dll",
"lib/net462/System.Threading.RateLimiting.xml",
"lib/net6.0/System.Threading.RateLimiting.dll",
"lib/net6.0/System.Threading.RateLimiting.xml",
"lib/net7.0/System.Threading.RateLimiting.dll",
"lib/net7.0/System.Threading.RateLimiting.xml",
"lib/net8.0/System.Threading.RateLimiting.dll",
"lib/net8.0/System.Threading.RateLimiting.xml",
"lib/netstandard2.0/System.Threading.RateLimiting.dll",
"lib/netstandard2.0/System.Threading.RateLimiting.xml",
"system.threading.ratelimiting.8.0.0.nupkg.sha512",
"system.threading.ratelimiting.nuspec",
"useSharedDesignerContext.txt"
]
},
"System.Threading.Tasks/4.3.0": {
"sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==",
"type": "package",

View File

@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "XxMlesTFLsE=",
"dgSpecHash": "j7OjEXb1ZGE=",
"success": true,
"projectFilePath": "C:\\Users\\nanxun\\Documents\\IM\\backend\\IMTest\\IMTest.csproj",
"expectedPackageFiles": [
@ -8,6 +8,9 @@
"C:\\Users\\nanxun\\.nuget\\packages\\automapper.extensions.microsoft.dependencyinjection\\12.0.0\\automapper.extensions.microsoft.dependencyinjection.12.0.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\castle.core\\5.1.1\\castle.core.5.1.1.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\coverlet.collector\\6.0.0\\coverlet.collector.6.0.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\masstransit\\8.5.5\\masstransit.8.5.5.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\masstransit.abstractions\\8.5.5\\masstransit.abstractions.8.5.5.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\masstransit.rabbitmq\\8.5.5\\masstransit.rabbitmq.8.5.5.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.aspnetcore.authentication.abstractions\\2.3.0\\microsoft.aspnetcore.authentication.abstractions.2.3.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.aspnetcore.authentication.jwtbearer\\8.0.21\\microsoft.aspnetcore.authentication.jwtbearer.8.0.21.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.aspnetcore.authorization\\2.3.0\\microsoft.aspnetcore.authorization.2.3.0.nupkg.sha512",
@ -43,6 +46,8 @@
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\8.0.1\\microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\8.0.2\\microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.extensions.diagnostics.abstractions\\8.0.1\\microsoft.extensions.diagnostics.abstractions.8.0.1.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.extensions.diagnostics.healthchecks\\8.0.0\\microsoft.extensions.diagnostics.healthchecks.8.0.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.extensions.diagnostics.healthchecks.abstractions\\8.0.0\\microsoft.extensions.diagnostics.healthchecks.abstractions.8.0.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.extensions.fileproviders.abstractions\\8.0.0\\microsoft.extensions.fileproviders.abstractions.8.0.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.extensions.hosting.abstractions\\8.0.1\\microsoft.extensions.hosting.abstractions.8.0.1.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\microsoft.extensions.logging\\8.0.1\\microsoft.extensions.logging.8.0.1.nupkg.sha512",
@ -72,6 +77,7 @@
"C:\\Users\\nanxun\\.nuget\\packages\\nuget.frameworks\\6.5.0\\nuget.frameworks.6.5.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\pipelines.sockets.unofficial\\2.2.8\\pipelines.sockets.unofficial.2.2.8.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\pomelo.entityframeworkcore.mysql\\8.0.3\\pomelo.entityframeworkcore.mysql.8.0.3.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\rabbitmq.client\\7.1.2\\rabbitmq.client.7.1.2.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512",
@ -148,6 +154,7 @@
"C:\\Users\\nanxun\\.nuget\\packages\\system.text.regularexpressions\\4.3.0\\system.text.regularexpressions.4.3.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\system.threading\\4.3.0\\system.threading.4.3.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\system.threading.channels\\8.0.0\\system.threading.channels.8.0.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\system.threading.ratelimiting\\8.0.0\\system.threading.ratelimiting.8.0.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\system.threading.tasks\\4.3.0\\system.threading.tasks.4.3.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\system.threading.tasks.extensions\\4.3.0\\system.threading.tasks.extensions.4.3.0.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\system.threading.timer\\4.3.0\\system.threading.timer.4.3.0.nupkg.sha512",
@ -162,5 +169,15 @@
"C:\\Users\\nanxun\\.nuget\\packages\\xunit.extensibility.execution\\2.5.3\\xunit.extensibility.execution.2.5.3.nupkg.sha512",
"C:\\Users\\nanxun\\.nuget\\packages\\xunit.runner.visualstudio\\2.5.3\\xunit.runner.visualstudio.2.5.3.nupkg.sha512"
],
"logs": []
"logs": [
{
"code": "Undefined",
"level": "Warning",
"message": "读取缓存文件 C:\\Users\\nanxun\\Documents\\IM\\backend\\IMTest\\obj\\project.nuget.cache 时遇到问题: '<' is an invalid start of a property name. Expected a '\"'. Path: $ | LineNumber: 2 | BytePositionInLine: 0.",
"projectPath": "C:\\Users\\nanxun\\Documents\\IM\\backend\\IMTest\\IMTest.csproj",
"warningLevel": 1,
"filePath": "C:\\Users\\nanxun\\Documents\\IM\\backend\\IMTest\\IMTest.csproj",
"targetGraphs": []
}
]
}

View File

@ -0,0 +1,13 @@
using IM_API.Domain.Events;
using MassTransit;
namespace IM_API.Application.EventHandlers.FriendAddHandler
{
public class FriendAddConversationHandler : IConsumer<FriendAddEvent>
{
public Task Consume(ConsumeContext<FriendAddEvent> context)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,31 @@
using IM_API.Domain.Events;
using IM_API.Models;
using MassTransit;
namespace IM_API.Application.EventHandlers.FriendAddHandler
{
public class FriendAddSignalRHandler : IConsumer<FriendAddEvent>
{
private readonly ImContext _context;
public FriendAddSignalRHandler(ImContext context)
{
_context = context;
}
public Task Consume(ConsumeContext<FriendAddEvent> context)
{
throw new NotImplementedException();
var @event = context.Message;
var RequestfriendShip = new Friend()
{
Avatar = @event.ResponseUser.Avatar,
UserId = @event.RequestUser.Id,
RemarkName = @event.RequestInfo.NickName,
Created = @event.RequestInfo.Created,
};
}
}
}

View File

@ -7,12 +7,13 @@ using IM_API.Interface.Services;
using IM_API.Models;
using IM_API.Services;
using IM_API.Tools;
using MassTransit;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace IM_API.Application.EventHandlers
namespace IM_API.Application.EventHandlers.MessageCreatedHandler
{
public class ConversationEventHandler : IEventHandler<MessageCreatedEvent>
public class ConversationEventHandler : IConsumer<MessageCreatedEvent>
{
private readonly IConversationService _conversationService;
private readonly ILogger<ConversationEventHandler> _logger;
@ -30,9 +31,12 @@ namespace IM_API.Application.EventHandlers
_context = imContext;
_mapper = mapper;
}
public async Task Handle(MessageCreatedEvent @event)
public async Task Consume(ConsumeContext<MessageCreatedEvent> context)
{
if(@event.ChatType == ChatType.PRIVATE)
var @event = context.Message;
if (@event.ChatType == ChatType.PRIVATE)
{
Conversation? userAConversation = await _context.Conversations.FirstOrDefaultAsync(
x => x.UserId == @event.MsgSenderId && x.TargetId == @event.MsgRecipientId
@ -40,9 +44,9 @@ namespace IM_API.Application.EventHandlers
Conversation? userBConversation = await _context.Conversations.FirstOrDefaultAsync(
x => x.UserId == @event.MsgRecipientId && x.TargetId == @event.MsgSenderId
);
if(userAConversation is null || userBConversation is null)
if (userAConversation is null || userBConversation is null)
{
_logger.LogError("消息事件更新会话信息失败:{@event}",@event);
_logger.LogError("消息事件更新会话信息失败:{@event}", @event);
}
userAConversation.LastMessage = @event.MessageContent;
userAConversation.LastReadMessageId = @event.MessageId;
@ -50,9 +54,10 @@ namespace IM_API.Application.EventHandlers
userBConversation.LastMessage = @event.MessageContent;
userBConversation.UnreadCount += 1;
userBConversation.LastMessageTime = @event.MessageCreated;
_context.UpdateRange(userAConversation,userBConversation);
_context.UpdateRange(userAConversation, userBConversation);
await _context.SaveChangesAsync();
}
}
}
}

View File

@ -5,11 +5,12 @@ using IM_API.Dtos;
using IM_API.Hubs;
using IM_API.Models;
using IM_API.Tools;
using MassTransit;
using Microsoft.AspNetCore.SignalR;
namespace IM_API.Application.EventHandlers
namespace IM_API.Application.EventHandlers.MessageCreatedHandler
{
public class SignalREventHandler : IEventHandler<MessageCreatedEvent>
public class SignalREventHandler : IConsumer<MessageCreatedEvent>
{
private readonly IHubContext<ChatHub> _hub;
private readonly IMapper _mapper;
@ -19,9 +20,10 @@ namespace IM_API.Application.EventHandlers
_mapper = mapper;
}
public async Task Handle(MessageCreatedEvent @event)
public async Task Consume(ConsumeContext<MessageCreatedEvent> context)
{
if(@event.ChatType == Models.ChatType.PRIVATE)
var @event = context.Message;
if (@event.ChatType == Models.ChatType.PRIVATE)
{
MessageBaseDto messageBaseDto = new MessageBaseDto
{

View File

@ -0,0 +1,40 @@
using IM_API.Application.EventHandlers.FriendAddHandler;
using IM_API.Application.EventHandlers.MessageCreatedHandler;
using MassTransit;
namespace IM_API.Configs
{
public static class MQConfig
{
public static IServiceCollection AddRabbitMQ(this IServiceCollection services, RabbitMqOptions options)
{
services.AddMassTransit(x =>
{
x.AddConsumer<ConversationEventHandler>();
x.AddConsumer<SignalREventHandler>();
x.AddConsumer<FriendAddConversationHandler>();
x.AddConsumer<FriendAddSignalRHandler>();
x.UsingRabbitMq((ctx,cfg) =>
{
cfg.Host(options.Host, "/", h =>
{
h.Username(options.Username);
h.Password(options.Password);
});
});
});
return services;
}
}
public class RabbitMqOptions
{
public string Host { get; set; }
public int Port { get; set; }
public string Username { get; set; }
public string Password { get;set; }
}
}

View File

@ -123,8 +123,6 @@ namespace IM_API.Configs
CreateMap<Group, ConversationDto>()
.ForMember(dest => dest.TargetAvatar, opt => opt.MapFrom(src => src.Avatar))
.ForMember(dest => dest.TargetName, opt => opt.MapFrom(src => src.Name));
}
}
}

View File

@ -23,8 +23,6 @@ namespace IM_API.Configs
services.AddTransient<IMessageSevice, MessageService>();
services.AddTransient<IConversationService, ConversationService>();
services.AddScoped<IEventBus, InMemoryEventBus>();
services.AddScoped<IEventHandler<MessageCreatedEvent>, SignalREventHandler>();
services.AddScoped<IEventHandler<MessageCreatedEvent>, ConversationEventHandler>();
services.AddSingleton<IJWTService, JWTService>();
services.AddSingleton<IRefreshTokenService, RedisRefreshTokenService>();
return services;

View File

@ -59,7 +59,9 @@ namespace IM_API.Controllers
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> HandleRequest([FromRoute]int id, [FromBody]FriendRequestHandleDto dto)
public async Task<IActionResult> HandleRequest(
[FromRoute]int id, [FromBody]FriendRequestHandleDto dto
)
{
await _friendService.HandleFriendRequestAsync(new HandleFriendRequestDto()
{

View File

@ -0,0 +1,24 @@
using IM_API.Dtos;
namespace IM_API.Domain.Events
{
public record FriendAddEvent:DomainEvent
{
public override string EventType => "IM.FRIENDS_FRIEND_ADD";
/// <summary>
/// 发起请求用户
/// </summary>
public UserInfoDto RequestUser { get; set; }
/// <summary>
/// 接受请求用户
/// </summary>
public UserInfoDto ResponseUser { get; set; }
public FriendRequestResDto RequestInfo { get; set; }
/// <summary>
/// 好友关系创建时间
/// </summary>
public DateTime Created { get; set; }
}
}

View File

@ -12,6 +12,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
<PackageReference Include="MassTransit.RabbitMQ" Version="8.5.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.21" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.21">

View File

@ -33,6 +33,8 @@ namespace IM_API
//×¢Èëredis
var redis = ConnectionMultiplexer.Connect(redisConStr);
builder.Services.AddSingleton<IConnectionMultiplexer>(redis);
builder.Services.AddRabbitMQ(configuration.GetSection("RabbitMqOptions").Get<RabbitMqOptions>());
builder.Services.AddAllService(configuration);

View File

@ -170,9 +170,7 @@ namespace IM_API.Services
throw new BaseException(CodeDefine.ALREADY_FRIENDS);
//生成实体
var friendRequst = _mapper.Map<FriendRequest>(dto);
var friend = _mapper.Map<Friend>(dto);
_context.FriendRequests.Add(friendRequst);
_context.Friends.Add(friend);
await _context.SaveChangesAsync();
return true;
}

View File

@ -6,6 +6,7 @@ using IM_API.Exceptions;
using IM_API.Interface.Services;
using IM_API.Models;
using IM_API.Tools;
using MassTransit;
using Microsoft.EntityFrameworkCore;
namespace IM_API.Services
@ -15,13 +16,19 @@ namespace IM_API.Services
private readonly ImContext _context;
private readonly ILogger<MessageService> _logger;
private readonly IMapper _mapper;
private readonly IEventBus _eventBus;
public MessageService(ImContext context, ILogger<MessageService> logger, IMapper mapper, IEventBus eventBus)
//废弃此处已使用rabbitMQ替代
//private readonly IEventBus _eventBus;
private readonly IPublishEndpoint _endpoint;
public MessageService(
ImContext context, ILogger<MessageService> logger, IMapper mapper, IEventBus eventBus,
IPublishEndpoint publishEndpoint
)
{
_context = context;
_logger = logger;
_mapper = mapper;
_eventBus = eventBus;
//_eventBus = eventBus;
_endpoint = publishEndpoint;
}
public async Task<List<MessageBaseDto>> GetMessagesAsync(int userId, int conversationId, int? msgId, int? pageSize, bool desc)
@ -93,10 +100,12 @@ namespace IM_API.Services
if (!isMember) throw new BaseException(CodeDefine.NO_GROUP_PERMISSION);
var message = _mapper.Map<Message>(dto);
message.Sender = senderId;
message.StreamKey = StreamKeyBuilder.Group(groupId);
message.StreamKey = StreamKeyBuilder.Group(
groupId);
_context.Messages.Add(message);
await _context.SaveChangesAsync();
await _eventBus.PublishAsync(_mapper.Map<MessageCreatedEvent>(message));
await _endpoint.Publish(_mapper.Map<MessageCreatedEvent>(message));
return _mapper.Map<MessageBaseDto>(message);
}
@ -112,7 +121,7 @@ namespace IM_API.Services
message.StreamKey = StreamKeyBuilder.Private(dto.SenderId, dto.ReceiverId);
_context.Messages.Add(message);
await _context.SaveChangesAsync();
await _eventBus.PublishAsync(_mapper.Map<MessageCreatedEvent>(message));
await _endpoint.Publish(_mapper.Map<MessageCreatedEvent>(message));
return _mapper.Map<MessageBaseDto>(message);
}
#endregion

View File

@ -16,5 +16,11 @@
"ConnectionStrings": {
"DefaultConnection": "Server=frp-era.com;Port=26582;Database=IM;User=product;Password=12345678;",
"Redis": "192.168.5.100:6379"
},
"RabbitMQOptions": {
"Host": "192.168.5.100",
"Port": 5672,
"Username": "test",
"Password": "123456"
}
}

View File

@ -1,7 +1,10 @@
allprojects {
repositories {
maven { url = uri("https://maven.aliyun.com/repository/google") }
maven { url = uri("https://maven.aliyun.com/repository/public") }
google()
mavenCentral()
}
}

View File

@ -2,4 +2,6 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
# ??????????
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.14-all.zip

View File

@ -11,6 +11,8 @@ pluginManagement {
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
maven { url = uri("https://maven.aliyun.com/repository/google") }
maven { url = uri("https://maven.aliyun.com/repository/public") }
google()
mavenCentral()
gradlePluginPortal()

14
frontend/app/lib/app.dart Normal file
View File

@ -0,0 +1,14 @@
import 'package:app/core/router/app_router.dart';
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: '测试应用',
routerConfig:appRouter
);
}
}

View File

@ -0,0 +1,5 @@
import 'dart:ui';
class AppColors {
static const Color primaryColor = Color(0xFF4FDBFF); // 绿
}

View File

@ -0,0 +1,26 @@
import 'package:app/features/auth/pages/login_page.dart';
import 'package:app/features/home/pages/index_page.dart';
import 'package:go_router/go_router.dart';
import '../../features/home/pages/main_page.dart';
final appRouter = GoRouter(
initialLocation: '/auth/login',
routes: [
GoRoute(path: '/auth/login', builder: (context, state) => const LoginPage()),
ShellRoute(
builder: (context, state, child) {
return MainPage(child: child);
},
routes: [
GoRoute(
path: '/',
builder: (context, state) => const IndexPage()
)
]
)
],
);

View File

@ -0,0 +1,167 @@
import 'package:app/core/constants/app_colors.dart';
import 'package:app/features/auth/pages/login_page.dart';
import 'package:flutter/material.dart';
class LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
actions: [
TextButton(
onPressed: () {},
child: const Text("找回密码", style: TextStyle(color: Colors.grey)),
),
],
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 20),
// 1. Logo/
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
color: AppColors.primaryColor.withOpacity(0.1),
shape: BoxShape.circle,
),
child: const Icon(
Icons.person_rounded,
size: 60,
color: AppColors.primaryColor,
),
),
const SizedBox(height: 24),
const Text(
"登录您的聊天账号",
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
const SizedBox(height: 60),
// 2. (线)
TextField(
decoration: InputDecoration(
labelText: "账号 / 邮箱 / 手机号",
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
),
),
),
const SizedBox(height: 25),
// 3.
TextField(
obscureText: true,
decoration: InputDecoration(
labelText: "请输入密码",
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
),
),
),
const SizedBox(height: 60),
// 4. ()
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.primaryColor,
foregroundColor: Colors.white,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: const Text(
"登 录",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
),
),
const SizedBox(height: 20),
// 5. /
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {},
child: const Text(
"注册账号",
style: TextStyle(color: Color(0xFF576B95)),
), //
),
const SizedBox(
height: 20,
child: VerticalDivider(color: Colors.grey),
),
TextButton(
onPressed: () {},
child: const Text(
"验证码登录",
style: TextStyle(color: Color(0xFF576B95)),
),
),
],
),
const SizedBox(height: 80),
// 6. (App必有)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Checkbox(
value: true,
activeColor: AppColors.primaryColor,
onChanged: (v) {},
),
const Text(
"我已阅读并同意",
style: TextStyle(color: Colors.grey, fontSize: 12),
),
const Text(
"《用户协议》",
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
),
const Text(
"",
style: TextStyle(color: Colors.grey, fontSize: 12),
),
const Text(
"《隐私政策》",
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
),
],
),
],
),
),
),
);
}
}

View File

@ -0,0 +1,12 @@
import 'package:app/features/auth/bloc/login_page_state.dart';
import 'package:flutter/cupertino.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@override
State<StatefulWidget> createState() {
return LoginPageState();
}
}

View File

@ -0,0 +1,10 @@
import 'package:app/features/home/pages/index_page.dart';
import 'package:flutter/cupertino.dart';
class IndexPageState extends State<IndexPage> {
@override
Widget build(BuildContext context) {
return Text('test');
}
}

View File

@ -0,0 +1,19 @@
import 'package:app/features/home/pages/main_page.dart';
import 'package:flutter/material.dart';
class MainPageState extends State<MainPage> {
int count = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(count.toString()),
backgroundColor: Colors.blue,
),
body: widget.child
);
}
}

View File

@ -0,0 +1,12 @@
import 'package:app/features/home/bloc/index_page_state.dart';
import 'package:flutter/cupertino.dart';
class IndexPage extends StatefulWidget {
const IndexPage({super.key});
@override
State<StatefulWidget> createState() {
return IndexPageState();
}
}

View File

@ -0,0 +1,13 @@
import 'package:app/features/home/bloc/main_page_state.dart';
import 'package:flutter/material.dart';
class MainPage extends StatefulWidget {
final Widget child;
const MainPage({super.key,required this.child});
@override
State<StatefulWidget> createState() {
return MainPageState();
}
}

View File

@ -1,178 +1,10 @@
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:app/app.dart';
import 'package:flutter/material.dart';
void main() => runApp(
const MaterialApp(home: IMLoginPage(), debugShowCheckedModeBanner: false),
);
void main(List<String> args){
class IMLoginPage extends StatefulWidget {
const IMLoginPage({super.key});
usePathUrlStrategy();
@override
State<IMLoginPage> createState() => _IMLoginPageState();
}
class _IMLoginPageState extends State<IMLoginPage> {
@override
Widget build(BuildContext context) {
// 绿
const Color primaryColor = Color(0xFF07C160); // 绿 0xFF0084FF ()
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
actions: [
TextButton(
onPressed: () {},
child: const Text("找回密码", style: TextStyle(color: Colors.grey)),
),
],
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 20),
// 1. Logo/
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
color: primaryColor.withOpacity(0.1),
shape: BoxShape.circle,
),
child: const Icon(
Icons.person_rounded,
size: 60,
color: primaryColor,
),
),
const SizedBox(height: 24),
const Text(
"登录您的聊天账号",
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
const SizedBox(height: 60),
// 2. (线)
TextField(
decoration: InputDecoration(
labelText: "账号 / 邮箱 / 手机号",
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
floatingLabelStyle: const TextStyle(color: primaryColor),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 2),
),
),
),
const SizedBox(height: 25),
// 3.
TextField(
obscureText: true,
decoration: InputDecoration(
labelText: "请输入密码",
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
floatingLabelStyle: const TextStyle(color: primaryColor),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 2),
),
),
),
const SizedBox(height: 60),
// 4. ()
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
foregroundColor: Colors.white,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: const Text(
"登 录",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
),
),
const SizedBox(height: 20),
// 5. /
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {},
child: const Text(
"注册账号",
style: TextStyle(color: Color(0xFF576B95)),
), //
),
const SizedBox(
height: 20,
child: VerticalDivider(color: Colors.grey),
),
TextButton(
onPressed: () {},
child: const Text(
"验证码登录",
style: TextStyle(color: Color(0xFF576B95)),
),
),
],
),
const SizedBox(height: 80),
// 6. (App必有)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Checkbox(
value: true,
activeColor: primaryColor,
onChanged: (v) {},
),
const Text(
"我已阅读并同意",
style: TextStyle(color: Colors.grey, fontSize: 12),
),
const Text(
"《用户协议》",
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
),
const Text(
"",
style: TextStyle(color: Colors.grey, fontSize: 12),
),
const Text(
"《隐私政策》",
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
),
],
),
],
),
),
),
);
}
}
runApp(const MyApp());
}

View File

@ -6,7 +6,7 @@ packages:
description:
name: async
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.13.0"
boolean_selector:
@ -14,7 +14,7 @@ packages:
description:
name: boolean_selector
sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.2"
characters:
@ -22,7 +22,7 @@ packages:
description:
name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.0"
clock:
@ -30,7 +30,7 @@ packages:
description:
name: clock
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.2"
collection:
@ -38,7 +38,7 @@ packages:
description:
name: collection
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.19.1"
cupertino_icons:
@ -46,7 +46,7 @@ packages:
description:
name: cupertino_icons
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.8"
fake_async:
@ -54,7 +54,7 @@ packages:
description:
name: fake_async
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.3"
flutter:
@ -67,7 +67,7 @@ packages:
description:
name: flutter_lints
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "6.0.0"
flutter_test:
@ -75,12 +75,25 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
go_router:
dependency: "direct main"
description:
name: go_router
sha256: eff94d2a6fc79fa8b811dde79c7549808c2346037ee107a1121b4a644c745f2a
url: "https://pub.flutter-io.cn"
source: hosted
version: "17.0.1"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "11.0.2"
leak_tracker_flutter_testing:
@ -88,7 +101,7 @@ packages:
description:
name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.10"
leak_tracker_testing:
@ -96,7 +109,7 @@ packages:
description:
name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.2"
lints:
@ -104,15 +117,23 @@ packages:
description:
name: lints
sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "6.0.0"
logging:
dependency: transitive
description:
name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
matcher:
dependency: transitive
description:
name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.17"
material_color_utilities:
@ -120,7 +141,7 @@ packages:
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.11.1"
meta:
@ -128,7 +149,7 @@ packages:
description:
name: meta
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.17.0"
path:
@ -136,7 +157,7 @@ packages:
description:
name: path
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.1"
sky_engine:
@ -149,7 +170,7 @@ packages:
description:
name: source_span
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.1"
stack_trace:
@ -157,7 +178,7 @@ packages:
description:
name: stack_trace
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.12.1"
stream_channel:
@ -165,7 +186,7 @@ packages:
description:
name: stream_channel
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
string_scanner:
@ -173,7 +194,7 @@ packages:
description:
name: string_scanner
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.1"
term_glyph:
@ -181,7 +202,7 @@ packages:
description:
name: term_glyph
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.2"
test_api:
@ -189,7 +210,7 @@ packages:
description:
name: test_api
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.7"
vector_math:
@ -197,7 +218,7 @@ packages:
description:
name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
vm_service:
@ -205,9 +226,9 @@ packages:
description:
name: vm_service
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "15.0.2"
sdks:
dart: ">=3.10.4 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
flutter: ">=3.35.0"

View File

@ -31,9 +31,13 @@ dependencies:
flutter:
sdk: flutter
flutter_web_plugins:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
go_router: ^17.0.1
dev_dependencies:
flutter_test:

View File

@ -5,15 +5,14 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:app/features/auth/pages/login_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:app/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const IMLoginPage());
await tester.pumpWidget(const LoginPage());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);

View File

@ -1,4 +1,4 @@
#VITE_API_BASE_URL = http://localhost:5202/api
#VITE_SIGNALR_BASE_URL = http://localhost:5202/chat
VITE_API_BASE_URL = http://192.168.5.116:7070/api
VITE_SIGNALR_BASE_URL = http://192.168.5.116:7070/chat
VITE_API_BASE_URL = http://localhost:5202/api
VITE_SIGNALR_BASE_URL = http://localhost:5202/chat
#VITE_API_BASE_URL = http://192.168.5.116:7070/api
#VITE_SIGNALR_BASE_URL = http://192.168.5.116:7070/chat

View File

@ -105,6 +105,7 @@
"integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.3",
@ -657,6 +658,7 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
},
@ -703,6 +705,7 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
}
@ -2667,6 +2670,7 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@ -2870,6 +2874,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.8.9",
"caniuse-lite": "^1.0.30001746",
@ -3484,6 +3489,7 @@
"integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1",
@ -3545,6 +3551,7 @@
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
@ -5266,6 +5273,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
@ -5305,6 +5313,7 @@
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@ -5928,6 +5937,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -6222,6 +6232,7 @@
"integrity": "sha512-ITcnkFeR3+fI8P1wMgItjGrR10170d8auB4EpMLPqmx6uxElH3a/hHGQabSHKdqd4FXWO1nFIp9rRn7JQ34ACQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.5.0",
@ -6483,6 +6494,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -6496,6 +6508,7 @@
"integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/chai": "^5.2.2",
"@vitest/expect": "3.2.4",
@ -6581,6 +6594,7 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.22.tgz",
"integrity": "sha512-toaZjQ3a/G/mYaLSbV+QsQhIdMo9x5rrqIpYRObsJ6T/J+RyCSFwN2LHNVH9v8uIcljDNa3QzPVdv3Y6b9hAJQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/compiler-dom": "3.5.22",
"@vue/compiler-sfc": "3.5.22",
@ -6610,7 +6624,6 @@
"integrity": "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"debug": "^4.4.0",
"eslint-scope": "^8.2.0",
@ -6635,7 +6648,6 @@
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},

View File

@ -18,4 +18,4 @@ export function useBrowserNotification() {
};
return { requestPermission, send };
}
}

View File

@ -14,9 +14,9 @@
<i style="color: red;line-height:0;" v-html="feather.icons['alert-circle'].toSvg({width:14})"></i>
<span>新消息无法通知点我授予通知权限</span>
</div>
<div class="scroll-area">
<div v-for="s in filteredSessions" :key="s.id"
<div v-for="s in filteredSessions" :key="s.id"
class="list-item" :class="{active: activeId === s.id}" @click="selectSession(s)">
<div class="avatar-container">
<img :src="s.targetAvatar ?? defaultAvatar" class="avatar-std" />
@ -40,8 +40,7 @@
<script setup>
import { useRouter } from 'vue-router'
import { ref, computed, nextTick, onMounted } from 'vue'
import { messageService } from '@/services/message'
import { ref, computed, onMounted } from 'vue'
import defaultAvatar from '@/assets/default_avatar.png'
import { formatDate } from '@/utils/formatDate'
import { useConversationStore } from '@/stores/conversation'
@ -56,7 +55,6 @@ const browserNotification = useBrowserNotification();
const searchQuery = ref('')
const activeId = ref(1)
const conversations = ref([]);
const searchUserModal = ref(false);
const msgTitleShow = ref(false);
const addMenuList = [
@ -92,7 +90,7 @@ function actionHandler(type){
case 'addFriend':
searchUserModal.value = true;
break;
default:
default:
break;
}
}
@ -102,10 +100,6 @@ async function requestNotificationPermission(){
if(Notification.permission === "granted") msgTitleShow.value = false;
}
async function loadConversation() {
const res = await messageService.getConversations();
conversations.value = res.data;
}
onMounted(async () => {
await conversationStore.loadUserConversations();
@ -212,8 +206,8 @@ onMounted(async () => {
.msg.other { flex-direction: row; }
/* 本人发的:翻转排列方向,靠右显示 */
.msg.mine {
flex-direction: row-reverse;
.msg.mine {
flex-direction: row-reverse;
}
.msg-content {
@ -316,4 +310,4 @@ textarea {
.nav-item { font-size: 24px; cursor: pointer; opacity: 0.5; }
.nav-item.active { opacity: 1; }
</style>
</style>

View File

@ -6,6 +6,9 @@ import vueDevTools from 'vite-plugin-vue-devtools'
// https://vite.dev/config/
export default defineConfig({
build: {
sourcemap: true
},
plugins: [
vue(),
vueDevTools(),