Compare commits
62
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6ff17ed02 | ||
|
|
c265868a51 | ||
|
|
7ebf23ddd8 | ||
|
|
8938dd40d4 | ||
|
|
a590aa0a26 | ||
|
|
98b5cad586 | ||
|
|
3d9335b97b | ||
|
|
1df3a0f30e | ||
|
|
e65eeb5ff7 | ||
|
|
e05497a478 | ||
|
|
ae99d3290f | ||
|
|
6cab42679c | ||
|
|
f9cc69698c | ||
|
|
f41e7137fe | ||
|
|
9d942b38c7 | ||
|
|
435db45a52 | ||
|
|
a31735dbe2 | ||
|
|
11840a2f30 | ||
|
|
f7e68555b1 | ||
|
|
cca84f88c0 | ||
|
|
77744015de | ||
|
|
e18fb9db48 | ||
|
|
bedcf97c9d | ||
|
|
df044e23f1 | ||
|
|
be621e9ae2 | ||
|
|
204853beb9 | ||
|
|
507788f6a3 | ||
|
|
ac54af3ff8 | ||
|
|
e7dbb651a2 | ||
|
|
f565e9d8a3 | ||
|
|
d855c8f8fb | ||
|
|
3b5e8b8eba | ||
|
|
3b126f17fc | ||
|
|
448cf25538 | ||
|
|
2b2d018658 | ||
|
|
816b01f13a | ||
|
|
da401a20c0 | ||
|
|
9e826153a4 | ||
|
|
ca4e2b7dd5 | ||
|
|
57deb5c9bf | ||
|
|
5323c29549 | ||
|
|
41963dde70 | ||
|
|
7d5699ad53 | ||
|
|
5274f0d22d | ||
|
|
e981ee190f | ||
|
|
85144dbf6f | ||
|
|
f42e990c45 | ||
|
|
705c96a230 | ||
|
|
885b4012ed | ||
|
|
2565678b22 | ||
|
|
f89007f52b | ||
|
|
36f442a1c2 | ||
|
|
0ea560694b | ||
|
|
c764f0eb03 | ||
|
|
600272486b | ||
|
|
0a440d2914 | ||
|
|
d641cb3275 | ||
|
|
26a13c4165 | ||
|
|
6dd93529c2 | ||
|
|
86841867f3 | ||
|
|
191c05461a | ||
|
|
cf09984056 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@
|
|||||||
"Key": "YourSuperSecretKey123456784124214190!",
|
"Key": "YourSuperSecretKey123456784124214190!",
|
||||||
"Issuer": "IMDemo",
|
"Issuer": "IMDemo",
|
||||||
"Audience": "IMClients",
|
"Audience": "IMClients",
|
||||||
"AccessTokenMinutes": 15,
|
"AccessTokenMinutes": 30,
|
||||||
"RefreshTokenDays": 30
|
"RefreshTokenDays": 30
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("IMTest")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("IMTest")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d852258d4fa2cf8bb6e4645d23894dfb8d8e4b1f")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1df3a0f30e469671b3e81d88574871d99c98af1a")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("IMTest")]
|
[assembly: System.Reflection.AssemblyProductAttribute("IMTest")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("IMTest")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("IMTest")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
db83b7267fcf05069f219fdc3eec31e2a4e8928c3bd33341b22a7f66599bc599
|
9546071857f1b0fa09bedf887ca476b7ecfa579752230651321c2a145e579c92
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
is_global = true
|
is_global = true
|
||||||
build_property.TargetFramework = net8.0
|
build_property.TargetFramework = net8.0
|
||||||
|
build_property.TargetFrameworkIdentifier = .NETCoreApp
|
||||||
|
build_property.TargetFrameworkVersion = v8.0
|
||||||
build_property.TargetPlatformMinVersion =
|
build_property.TargetPlatformMinVersion =
|
||||||
build_property.UsingMicrosoftNETSdkWeb =
|
build_property.UsingMicrosoftNETSdkWeb =
|
||||||
build_property.ProjectTypeGuids =
|
build_property.ProjectTypeGuids =
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// <auto-generated/>
|
// <auto-generated/>
|
||||||
global using global::System;
|
global using System;
|
||||||
global using global::System.Collections.Generic;
|
global using System.Collections.Generic;
|
||||||
global using global::System.IO;
|
global using System.IO;
|
||||||
global using global::System.Linq;
|
global using System.Linq;
|
||||||
global using global::System.Net.Http;
|
global using System.Net.Http;
|
||||||
global using global::System.Threading;
|
global using System.Threading;
|
||||||
global using global::System.Threading.Tasks;
|
global using System.Threading.Tasks;
|
||||||
global using global::Xunit;
|
global using Xunit;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -49,7 +49,7 @@
|
|||||||
"auditLevel": "low",
|
"auditLevel": "low",
|
||||||
"auditMode": "direct"
|
"auditMode": "direct"
|
||||||
},
|
},
|
||||||
"SdkAnalysisLevel": "9.0.300"
|
"SdkAnalysisLevel": "10.0.100"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net8.0": {
|
"net8.0": {
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.304/PortableRuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\10.0.102/PortableRuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
"auditLevel": "low",
|
"auditLevel": "low",
|
||||||
"auditMode": "direct"
|
"auditMode": "direct"
|
||||||
},
|
},
|
||||||
"SdkAnalysisLevel": "9.0.300"
|
"SdkAnalysisLevel": "10.0.100"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net8.0": {
|
"net8.0": {
|
||||||
@@ -155,6 +155,10 @@
|
|||||||
"target": "Package",
|
"target": "Package",
|
||||||
"version": "[12.0.0, )"
|
"version": "[12.0.0, )"
|
||||||
},
|
},
|
||||||
|
"MassTransit.RabbitMQ": {
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[8.5.5, )"
|
||||||
|
},
|
||||||
"Microsoft.AspNetCore.Authentication.JwtBearer": {
|
"Microsoft.AspNetCore.Authentication.JwtBearer": {
|
||||||
"target": "Package",
|
"target": "Package",
|
||||||
"version": "[8.0.21, )"
|
"version": "[8.0.21, )"
|
||||||
@@ -219,7 +223,7 @@
|
|||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.304/PortableRuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\10.0.102/PortableRuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\nanxun\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\nanxun\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.1</NuGetToolVersion>
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
<SourceRoot Include="C:\Users\nanxun\.nuget\packages\" />
|
<SourceRoot Include="C:\Users\nanxun\.nuget\packages\" />
|
||||||
|
|||||||
@@ -53,6 +53,57 @@
|
|||||||
"build/netstandard1.0/coverlet.collector.targets": {}
|
"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": {
|
"Microsoft.AspNetCore.Authentication.Abstractions/2.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -664,6 +715,38 @@
|
|||||||
"buildTransitive/net6.0/_._": {}
|
"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": {
|
"Microsoft.Extensions.FileProviders.Abstractions/8.0.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"dependencies": {
|
"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": {
|
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"runtimeTargets": {
|
"runtimeTargets": {
|
||||||
@@ -2655,6 +2755,22 @@
|
|||||||
"buildTransitive/net6.0/_._": {}
|
"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": {
|
"System.Threading.Tasks/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2859,6 +2975,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoMapper": "12.0.1",
|
"AutoMapper": "12.0.1",
|
||||||
"AutoMapper.Extensions.Microsoft.DependencyInjection": "12.0.0",
|
"AutoMapper.Extensions.Microsoft.DependencyInjection": "12.0.0",
|
||||||
|
"MassTransit.RabbitMQ": "8.5.5",
|
||||||
"Microsoft.AspNetCore.Authentication.JwtBearer": "8.0.21",
|
"Microsoft.AspNetCore.Authentication.JwtBearer": "8.0.21",
|
||||||
"Microsoft.AspNetCore.SignalR": "1.2.0",
|
"Microsoft.AspNetCore.SignalR": "1.2.0",
|
||||||
"Microsoft.VisualStudio.Azure.Containers.Tools.Targets": "1.22.1",
|
"Microsoft.VisualStudio.Azure.Containers.Tools.Targets": "1.22.1",
|
||||||
@@ -2987,6 +3104,69 @@
|
|||||||
"coverlet.collector.nuspec"
|
"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": {
|
"Microsoft.AspNetCore.Authentication.Abstractions/2.3.0": {
|
||||||
"sha512": "ve6uvLwKNRkfnO/QeN9M8eUJ49lCnWv/6/9p6iTEuiI6Rtsz+myaBAjdMzLuTViQY032xbTF5AdZF5BJzJJyXQ==",
|
"sha512": "ve6uvLwKNRkfnO/QeN9M8eUJ49lCnWv/6/9p6iTEuiI6Rtsz+myaBAjdMzLuTViQY032xbTF5AdZF5BJzJJyXQ==",
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -3887,6 +4067,44 @@
|
|||||||
"useSharedDesignerContext.txt"
|
"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": {
|
"Microsoft.Extensions.FileProviders.Abstractions/8.0.0": {
|
||||||
"sha512": "ZbaMlhJlpisjuWbvXr4LdAst/1XxH3vZ6A0BsgTphZ2L4PGuxRLz7Jr/S7mkAAnOn78Vu0fKhEgNF5JO3zfjqQ==",
|
"sha512": "ZbaMlhJlpisjuWbvXr4LdAst/1XxH3vZ6A0BsgTphZ2L4PGuxRLz7Jr/S7mkAAnOn78Vu0fKhEgNF5JO3zfjqQ==",
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -4801,6 +5019,23 @@
|
|||||||
"pomelo.entityframeworkcore.mysql.nuspec"
|
"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": {
|
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {
|
||||||
"sha512": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==",
|
"sha512": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==",
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -8051,6 +8286,35 @@
|
|||||||
"useSharedDesignerContext.txt"
|
"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": {
|
"System.Threading.Tasks/4.3.0": {
|
||||||
"sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==",
|
"sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==",
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -8541,7 +8805,7 @@
|
|||||||
"auditLevel": "low",
|
"auditLevel": "low",
|
||||||
"auditMode": "direct"
|
"auditMode": "direct"
|
||||||
},
|
},
|
||||||
"SdkAnalysisLevel": "9.0.300"
|
"SdkAnalysisLevel": "10.0.100"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net8.0": {
|
"net8.0": {
|
||||||
@@ -8588,8 +8852,16 @@
|
|||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.304/PortableRuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\10.0.102/PortableRuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"logs": [
|
||||||
|
{
|
||||||
|
"code": "Undefined",
|
||||||
|
"level": "Warning",
|
||||||
|
"warningLevel": 1,
|
||||||
|
"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."
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "/x8TFp9yNjk=",
|
"dgSpecHash": "j7OjEXb1ZGE=",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "C:\\Users\\nanxun\\Documents\\IM\\backend\\IMTest\\IMTest.csproj",
|
"projectFilePath": "C:\\Users\\nanxun\\Documents\\IM\\backend\\IMTest\\IMTest.csproj",
|
||||||
"expectedPackageFiles": [
|
"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\\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\\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\\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.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.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",
|
"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\\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.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.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.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.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",
|
"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\\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\\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\\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.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.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",
|
"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.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\\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.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\\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.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",
|
"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.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"
|
"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": []
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
+13
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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,
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using IM_API.Application.Interfaces;
|
||||||
|
using IM_API.Domain.Events;
|
||||||
|
using IM_API.Dtos;
|
||||||
|
using IM_API.Exceptions;
|
||||||
|
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.MessageCreatedHandler
|
||||||
|
{
|
||||||
|
public class ConversationEventHandler : IConsumer<MessageCreatedEvent>
|
||||||
|
{
|
||||||
|
private readonly IConversationService _conversationService;
|
||||||
|
private readonly ILogger<ConversationEventHandler> _logger;
|
||||||
|
private readonly ImContext _context;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
public ConversationEventHandler(
|
||||||
|
IConversationService conversationService,
|
||||||
|
ILogger<ConversationEventHandler> logger,
|
||||||
|
ImContext imContext,
|
||||||
|
IMapper mapper
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_conversationService = conversationService;
|
||||||
|
_logger = logger;
|
||||||
|
_context = imContext;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Consume(ConsumeContext<MessageCreatedEvent> context)
|
||||||
|
{
|
||||||
|
var @event = context.Message;
|
||||||
|
|
||||||
|
if (@event.ChatType == ChatType.PRIVATE)
|
||||||
|
{
|
||||||
|
Conversation? userAConversation = await _context.Conversations.FirstOrDefaultAsync(
|
||||||
|
x => x.UserId == @event.MsgSenderId && x.TargetId == @event.MsgRecipientId
|
||||||
|
);
|
||||||
|
Conversation? userBConversation = await _context.Conversations.FirstOrDefaultAsync(
|
||||||
|
x => x.UserId == @event.MsgRecipientId && x.TargetId == @event.MsgSenderId
|
||||||
|
);
|
||||||
|
if (userAConversation is null || userBConversation is null)
|
||||||
|
{
|
||||||
|
_logger.LogError("消息事件更新会话信息失败:{@event}", @event);
|
||||||
|
}
|
||||||
|
userAConversation.LastMessage = @event.MessageContent;
|
||||||
|
userAConversation.LastReadMessageId = @event.MessageId;
|
||||||
|
userAConversation.LastMessageTime = @event.MessageCreated;
|
||||||
|
userBConversation.LastMessage = @event.MessageContent;
|
||||||
|
userBConversation.UnreadCount += 1;
|
||||||
|
userBConversation.LastMessageTime = @event.MessageCreated;
|
||||||
|
_context.UpdateRange(userAConversation, userBConversation);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using IM_API.Application.Interfaces;
|
||||||
|
using IM_API.Domain.Events;
|
||||||
|
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.MessageCreatedHandler
|
||||||
|
{
|
||||||
|
public class SignalREventHandler : IConsumer<MessageCreatedEvent>
|
||||||
|
{
|
||||||
|
private readonly IHubContext<ChatHub> _hub;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
public SignalREventHandler(IHubContext<ChatHub> hub, IMapper mapper)
|
||||||
|
{
|
||||||
|
_hub = hub;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Consume(ConsumeContext<MessageCreatedEvent> context)
|
||||||
|
{
|
||||||
|
var @event = context.Message;
|
||||||
|
if (@event.ChatType == Models.ChatType.PRIVATE)
|
||||||
|
{
|
||||||
|
MessageBaseDto messageBaseDto = new MessageBaseDto
|
||||||
|
{
|
||||||
|
MsgId = @event.MessageId.ToString(),
|
||||||
|
ChatType = @event.ChatType.ToString(),
|
||||||
|
Content = @event.MessageContent,
|
||||||
|
GroupMemberId = null,
|
||||||
|
ReceiverId = @event.MsgRecipientId,
|
||||||
|
SenderId = @event.MsgSenderId,
|
||||||
|
TimeStamp = @event.MessageCreated,
|
||||||
|
Type = @event.MessageMsgType.ToString()
|
||||||
|
};
|
||||||
|
await _hub.Clients.Users(@event.MsgRecipientId.ToString()).SendAsync("ReceiveMessage", messageBaseDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using IM_API.Domain.Interfaces;
|
||||||
|
|
||||||
|
namespace IM_API.Application.Interfaces
|
||||||
|
{
|
||||||
|
public interface IEventBus
|
||||||
|
{
|
||||||
|
Task PublishAsync<TEvent>(TEvent @event) where TEvent : IEvent;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using IM_API.Domain.Interfaces;
|
||||||
|
|
||||||
|
namespace IM_API.Application.Interfaces
|
||||||
|
{
|
||||||
|
public interface IEventHandler<in TEvent> where TEvent : IEvent
|
||||||
|
{
|
||||||
|
Task Handle(TEvent @event);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using IM_API.Domain.Events;
|
||||||
using IM_API.Dtos;
|
using IM_API.Dtos;
|
||||||
using IM_API.Models;
|
using IM_API.Models;
|
||||||
|
|
||||||
@@ -25,20 +26,22 @@ namespace IM_API.Configs
|
|||||||
.ForMember(dest => dest.IsDeleted,opt => opt.MapFrom(src => 0))
|
.ForMember(dest => dest.IsDeleted,opt => opt.MapFrom(src => 0))
|
||||||
;
|
;
|
||||||
//好友信息模型转换
|
//好友信息模型转换
|
||||||
CreateMap<Friend, FriendInfoDto>();
|
CreateMap<Friend, FriendInfoDto>()
|
||||||
|
.ForMember(dest => dest.UserInfo, opt => opt.MapFrom(src => src.FriendNavigation))
|
||||||
|
;
|
||||||
//好友请求通过后新增好友关系
|
//好友请求通过后新增好友关系
|
||||||
CreateMap<FriendRequest, Friend>()
|
CreateMap<FriendRequestDto, Friend>()
|
||||||
.ForMember(dest => dest.UserId , opt => opt.MapFrom(src => src.RequestUser))
|
.ForMember(dest => dest.UserId , opt => opt.MapFrom(src => src.FromUserId))
|
||||||
.ForMember(dest => dest.FriendId , opt => opt.MapFrom(src => src.ResponseUser))
|
.ForMember(dest => dest.FriendId , opt => opt.MapFrom(src => src.ToUserId))
|
||||||
.ForMember(dest => dest.StatusEnum , opt =>opt.MapFrom(src => FriendStatus.Added))
|
.ForMember(dest => dest.StatusEnum , opt =>opt.MapFrom(src => FriendStatus.Pending))
|
||||||
.ForMember(dest => dest.RemarkName , opt => opt.MapFrom(src => src.ResponseUserNavigation.NickName))
|
.ForMember(dest => dest.RemarkName , opt => opt.MapFrom(src => src.RemarkName))
|
||||||
.ForMember(dest => dest.Created , opt => opt.MapFrom(src => DateTime.Now))
|
.ForMember(dest => dest.Created , opt => opt.MapFrom(src => DateTime.UtcNow))
|
||||||
;
|
;
|
||||||
//发起好友请求转换请求对象
|
//发起好友请求转换请求对象
|
||||||
CreateMap<FriendRequestDto, FriendRequest>()
|
CreateMap<FriendRequestDto, FriendRequest>()
|
||||||
.ForMember(dest => dest.RequestUser , opt => opt.MapFrom(src => src.FromUserId))
|
.ForMember(dest => dest.RequestUser , opt => opt.MapFrom(src => src.FromUserId))
|
||||||
.ForMember(dest => dest.ResponseUser , opt => opt.MapFrom(src => src.ToUserId))
|
.ForMember(dest => dest.ResponseUser , opt => opt.MapFrom(src => src.ToUserId))
|
||||||
.ForMember(dest => dest.Created , opt => opt.MapFrom(src => DateTime.Now))
|
.ForMember(dest => dest.Created , opt => opt.MapFrom(src => DateTime.UtcNow))
|
||||||
.ForMember(dest => dest.StateEnum , opt => opt.MapFrom(src => FriendRequestState.Pending))
|
.ForMember(dest => dest.StateEnum , opt => opt.MapFrom(src => FriendRequestState.Pending))
|
||||||
.ForMember(dest => dest.Description , opt => opt.MapFrom(src => src.Description))
|
.ForMember(dest => dest.Description , opt => opt.MapFrom(src => src.Description))
|
||||||
;
|
;
|
||||||
@@ -51,6 +54,7 @@ namespace IM_API.Configs
|
|||||||
.ForMember(dest => dest.ReceiverId, opt => opt.MapFrom(src => src.Recipient))
|
.ForMember(dest => dest.ReceiverId, opt => opt.MapFrom(src => src.Recipient))
|
||||||
.ForMember(dest => dest.Content, opt => opt.MapFrom(src => src.Content))
|
.ForMember(dest => dest.Content, opt => opt.MapFrom(src => src.Content))
|
||||||
.ForMember(dest => dest.TimeStamp, opt => opt.MapFrom(src => src.Created))
|
.ForMember(dest => dest.TimeStamp, opt => opt.MapFrom(src => src.Created))
|
||||||
|
.ForMember(dest => dest.GroupMemberId , opt => opt.MapFrom(src => src.GroupMemberId))
|
||||||
;
|
;
|
||||||
CreateMap<MessageBaseDto, Message>()
|
CreateMap<MessageBaseDto, Message>()
|
||||||
.ForMember(dest => dest.Sender, opt => opt.MapFrom(src => src.SenderId))
|
.ForMember(dest => dest.Sender, opt => opt.MapFrom(src => src.SenderId))
|
||||||
@@ -59,11 +63,66 @@ namespace IM_API.Configs
|
|||||||
.ForMember(dest => dest.Created, opt => opt.MapFrom(src => src.TimeStamp))
|
.ForMember(dest => dest.Created, opt => opt.MapFrom(src => src.TimeStamp))
|
||||||
.ForMember(dest => dest.Content, opt => opt.MapFrom(src => src.Content))
|
.ForMember(dest => dest.Content, opt => opt.MapFrom(src => src.Content))
|
||||||
.ForMember(dest => dest.Recipient, opt => opt.MapFrom(src => src.ReceiverId))
|
.ForMember(dest => dest.Recipient, opt => opt.MapFrom(src => src.ReceiverId))
|
||||||
|
.ForMember(dest => dest.StreamKey, opt => opt.Ignore() )
|
||||||
.ForMember(dest => dest.StateEnum, opt => opt.MapFrom(src => MessageState.Sent))
|
.ForMember(dest => dest.StateEnum, opt => opt.MapFrom(src => MessageState.Sent))
|
||||||
|
.ForMember(dest => dest.GroupMemberId, opt => opt.MapFrom(src => src.GroupMemberId))
|
||||||
.ForMember(dest => dest.ChatType, opt => opt.Ignore())
|
.ForMember(dest => dest.ChatType, opt => opt.Ignore())
|
||||||
.ForMember(dest => dest.MsgType, opt => opt.Ignore())
|
.ForMember(dest => dest.MsgType, opt => opt.Ignore())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//会话对象深拷贝
|
||||||
|
CreateMap<Conversation, Conversation>()
|
||||||
|
.ForMember(dest => dest.Id, opt => opt.Ignore())
|
||||||
|
.ForMember(dest => dest.UserId, opt => opt.Ignore())
|
||||||
|
.ForMember(dest => dest.TargetId, opt => opt.Ignore())
|
||||||
|
.ForMember(dest => dest.ChatType, opt => opt.Ignore())
|
||||||
|
.ForMember(dest => dest.StreamKey, opt => opt.Ignore())
|
||||||
|
;
|
||||||
|
|
||||||
|
//消息对象转消息创建事件对象
|
||||||
|
CreateMap<Message, MessageCreatedEvent>()
|
||||||
|
.ForMember(dest => dest.MessageMsgType, opt => opt.MapFrom(src => src.MsgTypeEnum))
|
||||||
|
.ForMember(dest => dest.ChatType, opt => opt.MapFrom(src => src.ChatTypeEnum))
|
||||||
|
.ForMember(dest => dest.MessageContent, opt => opt.MapFrom(src => src.Content))
|
||||||
|
.ForMember(dest => dest.State, opt => opt.MapFrom(src => src.StateEnum))
|
||||||
|
.ForMember(dest => dest.MessageCreated, opt => opt.MapFrom(src => src.Created))
|
||||||
|
.ForMember(dest => dest.MessageId, opt => opt.MapFrom(src => src.Id))
|
||||||
|
.ForMember(dest => dest.MsgRecipientId, opt => opt.MapFrom(src => src.Recipient))
|
||||||
|
.ForMember(dest => dest.MsgSenderId, opt => opt.MapFrom(src => src.Sender))
|
||||||
|
.ForMember(dest => dest.StreamKey, opt => opt.MapFrom(src => src.StreamKey))
|
||||||
|
;
|
||||||
|
|
||||||
|
//消息发送事件转换会话对象
|
||||||
|
CreateMap<MessageCreatedEvent, Conversation>()
|
||||||
|
.ForMember(dest => dest.LastReadMessageId, opt => opt.MapFrom(src => src.MessageId))
|
||||||
|
.ForMember(dest => dest.LastMessage, opt => opt.MapFrom(src => src.MessageContent))
|
||||||
|
.ForMember(dest => dest.ChatType, opt => opt.MapFrom(src => (int)src.ChatType))
|
||||||
|
.ForMember(dest => dest.UserId, opt => opt.MapFrom(src => src.MsgSenderId))
|
||||||
|
.ForMember(dest => dest.TargetId, opt => opt.MapFrom(src => src.MsgRecipientId))
|
||||||
|
.ForMember(dest => dest.UnreadCount, opt => opt.MapFrom(src => 0))
|
||||||
|
.ForMember(dest => dest.StreamKey, opt => opt.MapFrom(src => src.StreamKey))
|
||||||
|
.ForMember(dest => dest.LastMessageTime, opt => opt.MapFrom(src => DateTime.UtcNow))
|
||||||
|
;
|
||||||
|
|
||||||
|
//创建会话对象
|
||||||
|
CreateMap<Conversation, ConversationDto>()
|
||||||
|
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
|
||||||
|
.ForMember(dest => dest.LastMessage, opt => opt.MapFrom(src => src.LastMessage))
|
||||||
|
.ForMember(dest => dest.LastReadMessage, opt => opt.MapFrom(src => src.LastReadMessage))
|
||||||
|
.ForMember(dest => dest.LastReadMessageId, opt => opt.MapFrom(src => src.LastReadMessageId))
|
||||||
|
.ForMember(dest => dest.ChatType, opt => opt.MapFrom(src => src.ChatType))
|
||||||
|
.ForMember(dest => dest.DateTime, opt => opt.MapFrom(src => src.LastMessageTime))
|
||||||
|
.ForMember(dest => dest.TargetId, opt => opt.MapFrom(src => src.TargetId))
|
||||||
|
.ForMember(dest => dest.UnreadCount, opt => opt.MapFrom(src => src.UnreadCount))
|
||||||
|
.ForMember(dest => dest.UserId, opt => opt.MapFrom(src => src.UserId));
|
||||||
|
|
||||||
|
CreateMap<Friend, ConversationDto>()
|
||||||
|
.ForMember(dest => dest.TargetAvatar, opt => opt.MapFrom(src => src.Avatar))
|
||||||
|
.ForMember(dest => dest.TargetName, opt => opt.MapFrom(src => src.RemarkName));
|
||||||
|
|
||||||
|
CreateMap<Group, ConversationDto>()
|
||||||
|
.ForMember(dest => dest.TargetAvatar, opt => opt.MapFrom(src => src.Avatar))
|
||||||
|
.ForMember(dest => dest.TargetName, opt => opt.MapFrom(src => src.Name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
using IM_API.Interface.Services;
|
using IM_API.Application.EventHandlers;
|
||||||
|
using IM_API.Application.Interfaces;
|
||||||
|
using IM_API.Domain.Events;
|
||||||
|
using IM_API.Dtos;
|
||||||
|
using IM_API.Infrastructure.EventBus;
|
||||||
|
using IM_API.Interface.Services;
|
||||||
using IM_API.Services;
|
using IM_API.Services;
|
||||||
|
using IM_API.Tools;
|
||||||
|
using Microsoft.AspNetCore.Http.HttpResults;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace IM_API.Configs
|
namespace IM_API.Configs
|
||||||
{
|
{
|
||||||
@@ -7,14 +15,37 @@ namespace IM_API.Configs
|
|||||||
{
|
{
|
||||||
public static IServiceCollection AddAllService(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddAllService(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
|
||||||
services.AddAutoMapper(typeof(MapperConfig));
|
services.AddAutoMapper(typeof(MapperConfig));
|
||||||
services.AddTransient<IAuthService, AuthService>();
|
services.AddTransient<IAuthService, AuthService>();
|
||||||
services.AddTransient<IUserService, UserService>();
|
services.AddTransient<IUserService, UserService>();
|
||||||
services.AddTransient<IFriendSerivce, FriendService>();
|
services.AddTransient<IFriendSerivce, FriendService>();
|
||||||
services.AddTransient<IMessageSevice, MessageService>();
|
services.AddTransient<IMessageSevice, MessageService>();
|
||||||
|
services.AddTransient<IConversationService, ConversationService>();
|
||||||
|
services.AddScoped<IEventBus, InMemoryEventBus>();
|
||||||
services.AddSingleton<IJWTService, JWTService>();
|
services.AddSingleton<IJWTService, JWTService>();
|
||||||
services.AddSingleton<IRefreshTokenService,RedisRefreshTokenService>();
|
services.AddSingleton<IRefreshTokenService, RedisRefreshTokenService>();
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
public static IServiceCollection AddModelValidation(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.Configure<ApiBehaviorOptions>(options =>
|
||||||
|
{
|
||||||
|
options.InvalidModelStateResponseFactory = context =>
|
||||||
|
{
|
||||||
|
var errors = context.ModelState
|
||||||
|
.Where(e => e.Value.Errors.Count > 0)
|
||||||
|
.Select(e => new
|
||||||
|
{
|
||||||
|
Field = e.Key,
|
||||||
|
Message = e.Value.Errors.First().ErrorMessage
|
||||||
|
});
|
||||||
|
|
||||||
|
return new BadRequestObjectResult(new BaseResponse<object?>(CodeDefine.PARAMETER_ERROR.Code, errors.First().Message));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ namespace IM_API.Controllers
|
|||||||
return Ok(res);
|
return Ok(res);
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[ProducesResponseType(typeof(BaseResponse<LoginDto>),StatusCodes.Status200OK)]
|
||||||
public async Task<IActionResult> Refresh(RefreshDto dto)
|
public async Task<IActionResult> Refresh(RefreshDto dto)
|
||||||
{
|
{
|
||||||
(bool ok,int userId) = await _refreshTokenService.ValidateRefreshTokenAsync(dto.refreshToken);
|
(bool ok,int userId) = await _refreshTokenService.ValidateRefreshTokenAsync(dto.refreshToken);
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using IM_API.Dtos;
|
||||||
|
using IM_API.Interface.Services;
|
||||||
|
using IM_API.Models;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
|
namespace IM_API.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
[Authorize]
|
||||||
|
[ApiController]
|
||||||
|
public class ConversationController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IConversationService _conversationSerivice;
|
||||||
|
private readonly ILogger<ConversationController> _logger;
|
||||||
|
public ConversationController(IConversationService conversationSerivice, ILogger<ConversationController> logger)
|
||||||
|
{
|
||||||
|
_conversationSerivice = conversationSerivice;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> List()
|
||||||
|
{
|
||||||
|
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
var list = await _conversationSerivice.GetConversationsAsync(int.Parse(userIdStr));
|
||||||
|
var res = new BaseResponse<List<ConversationDto>>(list);
|
||||||
|
return Ok(res);
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> Get([FromQuery]int conversationId)
|
||||||
|
{
|
||||||
|
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
var conversation = await _conversationSerivice.GetConversationByIdAsync(int.Parse(userIdStr), conversationId);
|
||||||
|
var res = new BaseResponse<ConversationDto>(conversation);
|
||||||
|
return Ok(res);
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> Clear()
|
||||||
|
{
|
||||||
|
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
await _conversationSerivice.ClearConversationsAsync(int.Parse(userIdStr));
|
||||||
|
return Ok(new BaseResponse<object?>());
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> Delete(int cid)
|
||||||
|
{
|
||||||
|
await _conversationSerivice.DeleteConversationAsync(cid);
|
||||||
|
return Ok(new BaseResponse<object?>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,12 +44,12 @@ namespace IM_API.Controllers
|
|||||||
/// <param name="desc"></param>
|
/// <param name="desc"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<IActionResult> Requests(bool isReceived,int page,int limit,bool desc)
|
public async Task<IActionResult> Requests(int page,int limit,bool desc)
|
||||||
{
|
{
|
||||||
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
int userId = int.Parse(userIdStr);
|
int userId = int.Parse(userIdStr);
|
||||||
var list = await _friendService.GetFriendRequestListAsync(userId,isReceived,page,limit,desc);
|
var list = await _friendService.GetFriendRequestListAsync(userId,page,limit,desc);
|
||||||
var res = new BaseResponse<List<FriendRequest>>(list);
|
var res = new BaseResponse<List<FriendRequestResDto>>(list);
|
||||||
return Ok(res);
|
return Ok(res);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -59,13 +59,15 @@ namespace IM_API.Controllers
|
|||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[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()
|
await _friendService.HandleFriendRequestAsync(new HandleFriendRequestDto()
|
||||||
{
|
{
|
||||||
RequestId = id,
|
RequestId = id,
|
||||||
RemarkName = dto.remarkName,
|
RemarkName = dto.RemarkName,
|
||||||
Action = dto.action
|
Action = dto.Action
|
||||||
});
|
});
|
||||||
var res = new BaseResponse<object?>();
|
var res = new BaseResponse<object?>();
|
||||||
return Ok(res);
|
return Ok(res);
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using IM_API.Dtos;
|
||||||
|
using IM_API.Interface.Services;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
|
namespace IM_API.Controllers
|
||||||
|
{
|
||||||
|
[Authorize]
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
public class MessageController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IMessageSevice _messageService;
|
||||||
|
private readonly ILogger<MessageController> _logger;
|
||||||
|
public MessageController(IMessageSevice messageService, ILogger<MessageController> logger)
|
||||||
|
{
|
||||||
|
_messageService = messageService;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> SendPrivateMessage(MessageBaseDto dto)
|
||||||
|
{
|
||||||
|
var userIdstr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
await _messageService.SendPrivateMessageAsync(int.Parse(userIdstr), dto.ReceiverId, dto);
|
||||||
|
return Ok(new BaseResponse<object?>());
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> SendGroupMessage(MessageBaseDto dto)
|
||||||
|
{
|
||||||
|
var userIdstr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
await _messageService.SendGroupMessageAsync(int.Parse(userIdstr), dto.ReceiverId, dto);
|
||||||
|
return Ok(new BaseResponse<object?>());
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> GetMessageList([Required]int conversationId, int? msgId, int? pageSize)
|
||||||
|
{
|
||||||
|
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
var msgList = await _messageService.GetMessagesAsync(int.Parse(userIdStr), conversationId, msgId, pageSize, false);
|
||||||
|
var res = new BaseResponse<List<MessageBaseDto>>(msgList);
|
||||||
|
return Ok(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -83,7 +83,7 @@ namespace IM_API.Controllers
|
|||||||
{
|
{
|
||||||
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
int userId = int.Parse(userIdStr);
|
int userId = int.Parse(userIdStr);
|
||||||
await _userService.ResetPasswordAsync(userId,dto.oldPassword,dto.Password);
|
await _userService.ResetPasswordAsync(userId,dto.OldPassword,dto.Password);
|
||||||
return Ok(new BaseResponse<object?>());
|
return Ok(new BaseResponse<object?>());
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using IM_API.Domain.Interfaces;
|
||||||
|
|
||||||
|
namespace IM_API.Domain.Events
|
||||||
|
{
|
||||||
|
public abstract record DomainEvent: IEvent
|
||||||
|
{
|
||||||
|
public Guid EventId { get; init; } = Guid.NewGuid();
|
||||||
|
public DateTime OccurredAt { get; init; } = DateTime.UtcNow;
|
||||||
|
public long OperatorId { get; init; }
|
||||||
|
public string AggregateId { get; init; } = "";
|
||||||
|
public abstract string EventType { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using IM_API.Dtos;
|
||||||
|
using IM_API.Models;
|
||||||
|
|
||||||
|
namespace IM_API.Domain.Events
|
||||||
|
{
|
||||||
|
public record MessageCreatedEvent : DomainEvent
|
||||||
|
{
|
||||||
|
public override string EventType => "IM.MESSAGE.MESSAGE_CREATED";
|
||||||
|
public ChatType ChatType { get; set; }
|
||||||
|
public MessageMsgType MessageMsgType { get; set; }
|
||||||
|
public int MessageId { get; set; }
|
||||||
|
public string MessageContent { get; set; }
|
||||||
|
public int MsgSenderId { get; set; }
|
||||||
|
public int MsgRecipientId { get; set; }
|
||||||
|
public MessageState State { get; set; }
|
||||||
|
public DateTime MessageCreated { get; set; }
|
||||||
|
public string StreamKey { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace IM_API.Domain.Interfaces
|
||||||
|
{
|
||||||
|
public interface IEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -73,6 +73,10 @@ namespace IM_API.Dtos
|
|||||||
this.Code = codeDefine.Code;
|
this.Code = codeDefine.Code;
|
||||||
this.Message = codeDefine.Message;
|
this.Message = codeDefine.Message;
|
||||||
}
|
}
|
||||||
public BaseResponse() { }
|
public BaseResponse()
|
||||||
|
{
|
||||||
|
this.Code = CodeDefine.SUCCESS.Code;
|
||||||
|
this.Message = CodeDefine.SUCCESS.Message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
using IM_API.Models;
|
||||||
|
|
||||||
|
namespace IM_API.Dtos
|
||||||
|
{
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,32 @@
|
|||||||
using IM_API.Models;
|
using IM_API.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace IM_API.Dtos
|
namespace IM_API.Dtos
|
||||||
{
|
{
|
||||||
public record FriendInfoDto(int Id, int UserId,int FriendId,FriendStatus StatusEnum,DateTime Created,string RemarkName,string? Avatar);
|
public record FriendInfoDto
|
||||||
public record FriendRequestHandleDto(HandleFriendRequestAction action,string? remarkName);
|
{
|
||||||
|
public int Id { get; init; }
|
||||||
|
|
||||||
|
public int UserId { get; init; }
|
||||||
|
|
||||||
|
public int FriendId { get; init; }
|
||||||
|
|
||||||
|
public FriendStatus StatusEnum { get; init; }
|
||||||
|
|
||||||
|
public DateTime Created { get; init; }
|
||||||
|
|
||||||
|
public string RemarkName { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
public string? Avatar { get; init; }
|
||||||
|
public UserInfoDto UserInfo { get; init; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public record FriendRequestHandleDto
|
||||||
|
{
|
||||||
|
[Required(ErrorMessage = "操作必填")]
|
||||||
|
public HandleFriendRequestAction Action { get; init; }
|
||||||
|
|
||||||
|
[StringLength(20, ErrorMessage = "备注名最大20个字符")]
|
||||||
|
public string? RemarkName { get; init; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
namespace IM_API.Dtos
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace IM_API.Dtos
|
||||||
{
|
{
|
||||||
public class FriendRequestDto
|
public class FriendRequestDto
|
||||||
{
|
{
|
||||||
public int FromUserId { get; set; }
|
public int? FromUserId { get; set; }
|
||||||
public int ToUserId { get; set; }
|
public int ToUserId { get; set; }
|
||||||
|
[Required(ErrorMessage = "备注名必填")]
|
||||||
|
[StringLength(20, ErrorMessage = "备注名不能超过20位字符")]
|
||||||
public string? RemarkName { get; set; }
|
public string? RemarkName { get; set; }
|
||||||
|
[StringLength(50, ErrorMessage = "描述不能超过50字符")]
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using IM_API.Models;
|
||||||
|
|
||||||
|
namespace IM_API.Dtos
|
||||||
|
{
|
||||||
|
public class FriendRequestResDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 申请人
|
||||||
|
/// </summary>
|
||||||
|
public int RequestUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 被申请人
|
||||||
|
/// </summary>
|
||||||
|
public int ResponseUser { get; set; }
|
||||||
|
public string Avatar { get; set; }
|
||||||
|
public string NickName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 申请时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 申请附言
|
||||||
|
/// </summary>
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 申请状态(0:待通过,1:拒绝,2:同意,3:拉黑)
|
||||||
|
/// </summary>
|
||||||
|
public FriendRequestState State { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,17 @@
|
|||||||
namespace IM_API.Dtos
|
using IM_API.Tools;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace IM_API.Dtos
|
||||||
{
|
{
|
||||||
public class LoginRequestDto
|
public class LoginRequestDto
|
||||||
{
|
{
|
||||||
|
[Required(ErrorMessage = "用户名不能为空")]
|
||||||
|
[StringLength(20, ErrorMessage = "用户名不能超过20字符")]
|
||||||
|
[RegularExpression(@"^[A-Za-z0-9]+$",ErrorMessage = "用户名只能为英文或数字")]
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "密码不能为空")]
|
||||||
|
[StringLength(50, ErrorMessage = "密码不能超过50字符")]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
namespace IM_API.Dtos
|
namespace IM_API.Dtos
|
||||||
{
|
{
|
||||||
public record MessageBaseDto(
|
public record MessageBaseDto
|
||||||
string Type,string ChatType, string? MsgId,int SenderId,int ReceiverId,string Content,DateTime TimeStamp);
|
{
|
||||||
|
// 使用 { get; init; } 确保对象创建后不可修改,且支持无参构造
|
||||||
|
public string Type { get; init; } = default!;
|
||||||
|
public string ChatType { get; init; } = default!;
|
||||||
|
public string? 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 MessageBaseDto() { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,19 @@
|
|||||||
namespace IM_API.Dtos
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace IM_API.Dtos
|
||||||
{
|
{
|
||||||
public class RegisterRequestDto
|
public class RegisterRequestDto
|
||||||
{
|
{
|
||||||
|
[Required(ErrorMessage = "用户名不能为空")]
|
||||||
|
[MaxLength(20, ErrorMessage = "用户名不能超过20字符")]
|
||||||
|
[RegularExpression(@"^[A-Za-z0-9]+$", ErrorMessage = "用户名只能为英文或数字")]
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
|
[Required(ErrorMessage = "密码不能为空")]
|
||||||
|
[MaxLength(50, ErrorMessage = "密码不能超过50字符")]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
[Required(ErrorMessage = "昵称不能为空")]
|
||||||
|
[MaxLength(20, ErrorMessage = "昵称不能超过20字符")]
|
||||||
|
|
||||||
public string? NickName { get; set; }
|
public string? NickName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
namespace IM_API.Dtos
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace IM_API.Dtos
|
||||||
{
|
{
|
||||||
public class UpdateUserDto
|
public class UpdateUserDto
|
||||||
{
|
{
|
||||||
|
[MaxLength(20, ErrorMessage = "昵称不能超过50字符")]
|
||||||
public string? NickName { get; set; }
|
public string? NickName { get; set; }
|
||||||
public string? Avatar { get; set; }
|
public string? Avatar { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
using IM_API.Models;
|
using IM_API.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace IM_API.Dtos
|
namespace IM_API.Dtos
|
||||||
{
|
{
|
||||||
public record PasswordResetDto(string oldPassword,string Password);
|
public record PasswordResetDto
|
||||||
public record OnlineStatusSetDto(UserOnlineStatus OnlineStatus);
|
{
|
||||||
|
[Required(ErrorMessage = "旧密码不能为空")]
|
||||||
|
public string OldPassword { get; init; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "新密码不能为空")]
|
||||||
|
[MaxLength(50, ErrorMessage = "密码不能超过50个字符")]
|
||||||
|
public string Password { get; init; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public record OnlineStatusSetDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public UserOnlineStatus OnlineStatus { get; init; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
using IM_API.Dtos;
|
using AutoMapper;
|
||||||
|
using IM_API.Application.Interfaces;
|
||||||
|
using IM_API.Domain.Events;
|
||||||
|
using IM_API.Dtos;
|
||||||
using IM_API.Interface.Services;
|
using IM_API.Interface.Services;
|
||||||
|
using IM_API.Models;
|
||||||
using IM_API.Tools;
|
using IM_API.Tools;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
@@ -9,22 +13,34 @@ namespace IM_API.Hubs
|
|||||||
public class ChatHub:Hub
|
public class ChatHub:Hub
|
||||||
{
|
{
|
||||||
private IMessageSevice _messageService;
|
private IMessageSevice _messageService;
|
||||||
public ChatHub(IMessageSevice messageService)
|
private readonly IConversationService _conversationService;
|
||||||
|
private readonly IEventBus _eventBus;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
public ChatHub(IMessageSevice messageService, IConversationService conversationService, IEventBus eventBus, IMapper mapper)
|
||||||
{
|
{
|
||||||
_messageService = messageService;
|
_messageService = messageService;
|
||||||
|
_conversationService = conversationService;
|
||||||
|
_eventBus = eventBus;
|
||||||
|
_mapper = mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async override Task OnConnectedAsync()
|
public async override Task OnConnectedAsync()
|
||||||
{
|
{
|
||||||
if (!Context.User.Identity.IsAuthenticated)
|
if (!Context.User.Identity.IsAuthenticated)
|
||||||
{
|
{
|
||||||
await Clients.Caller.SendAsync("ReceiveMessage",new BaseResponse<object?>(CodeDefine.AUTH_FAILED));
|
|
||||||
Context.Abort();
|
Context.Abort();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//将用户加入已加入聊天的会话组
|
||||||
|
string userIdStr = Context.User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
var keys = await _conversationService.GetUserAllStreamKeyAsync(int.Parse(userIdStr));
|
||||||
|
foreach(var key in keys)
|
||||||
|
{
|
||||||
|
await Groups.AddToGroupAsync(Context.ConnectionId,key);
|
||||||
|
}
|
||||||
await base.OnConnectedAsync();
|
await base.OnConnectedAsync();
|
||||||
}
|
}
|
||||||
public async Task SendPrivateMessage(MessageBaseDto dto)
|
public async Task SendMessage(MessageBaseDto dto)
|
||||||
{
|
{
|
||||||
if (!Context.User.Identity.IsAuthenticated)
|
if (!Context.User.Identity.IsAuthenticated)
|
||||||
{
|
{
|
||||||
@@ -33,8 +49,27 @@ namespace IM_API.Hubs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var userIdStr = Context.User.FindFirstValue(ClaimTypes.NameIdentifier);
|
var userIdStr = Context.User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
await _messageService.SendPrivateMessageAsync(int.Parse(userIdStr),dto.ReceiverId,dto);
|
MessageBaseDto msgInfo = null;
|
||||||
await Clients.Users(dto.ReceiverId.ToString()).SendAsync("ReceiveMessage", userIdStr, dto.Content);
|
if(dto.ChatType.ToLower() == ChatType.PRIVATE.ToString().ToLower())
|
||||||
|
{
|
||||||
|
msgInfo = await _messageService.SendPrivateMessageAsync(int.Parse(userIdStr), dto.ReceiverId, dto);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msgInfo = await _messageService.SendGroupMessageAsync(int.Parse(userIdStr), dto.ReceiverId, dto);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
public async Task ClearUnreadCount(int conversationId)
|
||||||
|
{
|
||||||
|
if (!Context.User.Identity.IsAuthenticated)
|
||||||
|
{
|
||||||
|
await Clients.Caller.SendAsync("ReceiveMessage", new BaseResponse<object?>(CodeDefine.AUTH_FAILED));
|
||||||
|
Context.Abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var userIdStr = Context.User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
await _conversationService.ClearUnreadCountAsync(int.Parse(userIdStr), conversationId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper" Version="12.0.1" />
|
<PackageReference Include="AutoMapper" Version="12.0.1" />
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
|
<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.Authentication.JwtBearer" Version="8.0.21" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.2.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.21">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.21">
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using IM_API.Application.Interfaces;
|
||||||
|
using IM_API.Domain.Interfaces;
|
||||||
|
|
||||||
|
namespace IM_API.Infrastructure.EventBus
|
||||||
|
{
|
||||||
|
public class InMemoryEventBus : IEventBus
|
||||||
|
{
|
||||||
|
private IServiceProvider _serviceProvider;
|
||||||
|
private ILogger<InMemoryEventBus> _logger;
|
||||||
|
public InMemoryEventBus(IServiceProvider serviceProvider, ILogger<InMemoryEventBus> logger)
|
||||||
|
{
|
||||||
|
_serviceProvider = serviceProvider;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task PublishAsync<TEvent>(TEvent @event) where TEvent : IEvent
|
||||||
|
{
|
||||||
|
var handlers = _serviceProvider.GetServices<IEventHandler<TEvent>>();
|
||||||
|
foreach (var handler in handlers)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await handler.Handle(@event);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
_logger.LogError("EventHandler error:"+e.Message, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,12 +10,37 @@ namespace IM_API.Interface.Services
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="clearConversationsDto"></param>
|
/// <param name="clearConversationsDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> ClearConversationsAsync(ClearConversationsDto clearConversationsDto);
|
Task<bool> ClearConversationsAsync(int userId);
|
||||||
|
/// <summary>
|
||||||
|
/// 删除单个聊天会话
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conversationId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> DeleteConversationAsync(int conversationId);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取用户当前消息会话
|
/// 获取用户当前消息会话
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">用户id</param>
|
/// <param name="userId">用户id</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<Conversation> GetConversationsAsync(int userId);
|
Task<List<ConversationDto>> GetConversationsAsync(int userId);
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定用户的所有推送标识符
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<string>> GetUserAllStreamKeyAsync(int userId);
|
||||||
|
/// <summary>
|
||||||
|
/// 获取单个conversation信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conversationId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<ConversationDto> GetConversationByIdAsync(int userId, int conversationId);
|
||||||
|
/// <summary>
|
||||||
|
/// 清空未读消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="conversationId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> ClearUnreadCountAsync(int userId, int conversationId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace IM_API.Interface.Services
|
|||||||
/// <param name="page"></param>
|
/// <param name="page"></param>
|
||||||
/// <param name="limit"></param>
|
/// <param name="limit"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<FriendRequest>> GetFriendRequestListAsync(int userId,bool isReceived,int page,int limit, bool desc);
|
Task<List<FriendRequestResDto>> GetFriendRequestListAsync(int userId,int page,int limit, bool desc);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 处理好友请求
|
/// 处理好友请求
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace IM_API.Interface.Services
|
|||||||
/// <param name="receiverId">接收人</param>
|
/// <param name="receiverId">接收人</param>
|
||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> SendPrivateMessageAsync(int senderId,int receiverId,MessageBaseDto dto);
|
Task<MessageBaseDto> SendPrivateMessageAsync(int senderId,int receiverId,MessageBaseDto dto);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送群聊消息
|
/// 发送群聊消息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -19,26 +19,16 @@ namespace IM_API.Interface.Services
|
|||||||
/// <param name="groupId">接收群id</param>
|
/// <param name="groupId">接收群id</param>
|
||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> SendGroupMessageAsync(int senderId,int groupId,MessageBaseDto dto);
|
Task<MessageBaseDto> SendGroupMessageAsync(int senderId,int groupId,MessageBaseDto dto);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取私聊消息列表
|
/// 获取消息列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userAId"></param>
|
/// <param name="conversationId">会话id(用于获取指定用户间聊天消息)</param>
|
||||||
/// <param name="userBId"></param>
|
/// <param name="msgId">消息id</param>
|
||||||
/// <param name="page"></param>
|
/// <param name="pageSize">获取消息数量</param>
|
||||||
/// <param name="pageSize"></param>
|
|
||||||
/// <param name="desc"></param>
|
/// <param name="desc"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<MessageBaseDto>> GetPrivateMessagesAsync(int userAId,int userBId,int page,int pageSize,bool desc);
|
Task<List<MessageBaseDto>> GetMessagesAsync(int userId, int conversationId,int? msgId,int? pageSize,bool desc);
|
||||||
/// <summary>
|
|
||||||
/// 获取群聊消息列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="groupId"></param>
|
|
||||||
/// <param name="page"></param>
|
|
||||||
/// <param name="pageSize"></param>
|
|
||||||
/// <param name="desc"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<MessageBaseDto>> GetGroupMessagesAsync(int groupId, int page, int pageSize, bool desc);
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取未读消息数
|
/// 获取未读消息数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -18,21 +18,33 @@ public partial class Conversation
|
|||||||
public int TargetId { get; set; }
|
public int TargetId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 消息类型(同Messages.MsgType)
|
/// 最后一条未读消息ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MsgType { get; set; }
|
public int? LastReadMessageId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 最后一条消息ID
|
|
||||||
/// </summary>
|
|
||||||
public int LastMessageId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 未读消息数
|
/// 未读消息数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UnreadCount { get; set; }
|
public int UnreadCount { get; set; }
|
||||||
|
|
||||||
public virtual Message LastMessage { get; set; } = null!;
|
public int ChatType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 消息推送唯一标识符
|
||||||
|
/// </summary>
|
||||||
|
public string StreamKey { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后一条最新消息
|
||||||
|
/// </summary>
|
||||||
|
public string LastMessage { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后一条消息发送时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime LastMessageTime { get; set; }
|
||||||
|
|
||||||
|
public virtual Message? LastReadMessage { get; set; }
|
||||||
|
|
||||||
public virtual User User { get; set; } = null!;
|
public virtual User User { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ public partial class Group
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 群头像
|
||||||
|
/// </summary>
|
||||||
|
public string Avatar { get; set; } = null!;
|
||||||
|
|
||||||
public virtual ICollection<GroupInvite> GroupInvites { get; set; } = new List<GroupInvite>();
|
public virtual ICollection<GroupInvite> GroupInvites { get; set; } = new List<GroupInvite>();
|
||||||
|
|
||||||
public virtual User GroupMasterNavigation { get; set; } = null!;
|
public virtual User GroupMasterNavigation { get; set; } = null!;
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal;
|
|
||||||
|
|
||||||
namespace IM_API.Models;
|
namespace IM_API.Models;
|
||||||
|
|
||||||
public partial class ImContext : DbContext
|
public partial class ImContext : DbContext
|
||||||
{
|
{
|
||||||
public ImContext()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImContext(DbContextOptions<ImContext> options)
|
public ImContext(DbContextOptions<ImContext> options)
|
||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
@@ -49,17 +44,6 @@ public partial class ImContext : DbContext
|
|||||||
public virtual DbSet<Role> Roles { get; set; }
|
public virtual DbSet<Role> Roles { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<User> Users { get; set; }
|
public virtual DbSet<User> Users { get; set; }
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
||||||
{
|
|
||||||
if (!optionsBuilder.IsConfigured)
|
|
||||||
{
|
|
||||||
optionsBuilder.UseMySql(
|
|
||||||
"server=frp-era.com;port=26582;database=IM;user=product;password=12345678",
|
|
||||||
ServerVersion.Parse("5.7.44-mysql")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@@ -117,18 +101,25 @@ public partial class ImContext : DbContext
|
|||||||
|
|
||||||
entity.HasIndex(e => e.UserId, "Userid");
|
entity.HasIndex(e => e.UserId, "Userid");
|
||||||
|
|
||||||
entity.HasIndex(e => e.LastMessageId, "lastMessageId");
|
entity.HasIndex(e => e.LastReadMessageId, "lastMessageId");
|
||||||
|
|
||||||
entity.Property(e => e.Id)
|
entity.Property(e => e.Id)
|
||||||
.HasColumnType("int(11)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("ID");
|
.HasColumnName("ID");
|
||||||
entity.Property(e => e.LastMessageId)
|
entity.Property(e => e.ChatType).HasColumnType("int(11)");
|
||||||
.HasComment("最后一条消息ID ")
|
entity.Property(e => e.LastMessage)
|
||||||
|
.HasMaxLength(255)
|
||||||
|
.HasComment("最后一条最新消息");
|
||||||
|
entity.Property(e => e.LastMessageTime)
|
||||||
|
.HasComment("最后一条消息发送时间")
|
||||||
|
.HasColumnType("datetime");
|
||||||
|
entity.Property(e => e.LastReadMessageId)
|
||||||
|
.HasComment("最后一条未读消息ID ")
|
||||||
.HasColumnType("int(11)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("lastMessageId");
|
.HasColumnName("lastReadMessageId");
|
||||||
entity.Property(e => e.MsgType)
|
entity.Property(e => e.StreamKey)
|
||||||
.HasComment("消息类型(同Messages.MsgType) ")
|
.HasMaxLength(255)
|
||||||
.HasColumnType("int(11)");
|
.HasComment("消息推送唯一标识符");
|
||||||
entity.Property(e => e.TargetId)
|
entity.Property(e => e.TargetId)
|
||||||
.HasComment("对方ID(群聊为群聊ID,单聊为单聊ID) ")
|
.HasComment("对方ID(群聊为群聊ID,单聊为单聊ID) ")
|
||||||
.HasColumnType("int(11)");
|
.HasColumnType("int(11)");
|
||||||
@@ -139,9 +130,8 @@ public partial class ImContext : DbContext
|
|||||||
.HasComment("用户")
|
.HasComment("用户")
|
||||||
.HasColumnType("int(11)");
|
.HasColumnType("int(11)");
|
||||||
|
|
||||||
entity.HasOne(d => d.LastMessage).WithMany(p => p.Conversations)
|
entity.HasOne(d => d.LastReadMessage).WithMany(p => p.Conversations)
|
||||||
.HasForeignKey(d => d.LastMessageId)
|
.HasForeignKey(d => d.LastReadMessageId)
|
||||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
|
||||||
.HasConstraintName("conversations_ibfk_2");
|
.HasConstraintName("conversations_ibfk_2");
|
||||||
|
|
||||||
entity.HasOne(d => d.User).WithMany(p => p.Conversations)
|
entity.HasOne(d => d.User).WithMany(p => p.Conversations)
|
||||||
@@ -337,6 +327,9 @@ public partial class ImContext : DbContext
|
|||||||
entity.Property(e => e.Auhority)
|
entity.Property(e => e.Auhority)
|
||||||
.HasComment("群权限\r\n(0:需管理员同意,1:任意人可加群,2:不允许任何人加入)")
|
.HasComment("群权限\r\n(0:需管理员同意,1:任意人可加群,2:不允许任何人加入)")
|
||||||
.HasColumnType("tinyint(4)");
|
.HasColumnType("tinyint(4)");
|
||||||
|
entity.Property(e => e.Avatar)
|
||||||
|
.HasMaxLength(255)
|
||||||
|
.HasComment("群头像");
|
||||||
entity.Property(e => e.Created)
|
entity.Property(e => e.Created)
|
||||||
.HasComment("群聊创建时间")
|
.HasComment("群聊创建时间")
|
||||||
.HasColumnType("datetime");
|
.HasColumnType("datetime");
|
||||||
@@ -545,6 +538,9 @@ public partial class ImContext : DbContext
|
|||||||
entity.Property(e => e.Created)
|
entity.Property(e => e.Created)
|
||||||
.HasComment("发送时间 ")
|
.HasComment("发送时间 ")
|
||||||
.HasColumnType("datetime");
|
.HasColumnType("datetime");
|
||||||
|
entity.Property(e => e.GroupMemberId)
|
||||||
|
.HasComment("若为群消息则表示具体的成员id")
|
||||||
|
.HasColumnType("int(11)");
|
||||||
entity.Property(e => e.MsgType)
|
entity.Property(e => e.MsgType)
|
||||||
.HasComment("消息类型\r\n(0:文本,1:图片,2:语音,3:视频,4:文件,5:语音聊天,6:视频聊天)")
|
.HasComment("消息类型\r\n(0:文本,1:图片,2:语音,3:视频,4:文件,5:语音聊天,6:视频聊天)")
|
||||||
.HasColumnType("tinyint(4)");
|
.HasColumnType("tinyint(4)");
|
||||||
@@ -557,6 +553,9 @@ public partial class ImContext : DbContext
|
|||||||
entity.Property(e => e.State)
|
entity.Property(e => e.State)
|
||||||
.HasComment("消息状态(0:已发送,1:已撤回) ")
|
.HasComment("消息状态(0:已发送,1:已撤回) ")
|
||||||
.HasColumnType("tinyint(4)");
|
.HasColumnType("tinyint(4)");
|
||||||
|
entity.Property(e => e.StreamKey)
|
||||||
|
.HasMaxLength(255)
|
||||||
|
.HasComment("消息推送唯一标识符");
|
||||||
|
|
||||||
entity.HasOne(d => d.SenderNavigation).WithMany(p => p.Messages)
|
entity.HasOne(d => d.SenderNavigation).WithMany(p => p.Messages)
|
||||||
.HasForeignKey(d => d.Sender)
|
.HasForeignKey(d => d.Sender)
|
||||||
|
|||||||
@@ -44,6 +44,16 @@ public partial class Message
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 消息推送唯一标识符
|
||||||
|
/// </summary>
|
||||||
|
public string StreamKey { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 若为群消息则表示具体的成员id
|
||||||
|
/// </summary>
|
||||||
|
public int? GroupMemberId { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<Conversation> Conversations { get; set; } = new List<Conversation>();
|
public virtual ICollection<Conversation> Conversations { get; set; } = new List<Conversation>();
|
||||||
|
|
||||||
public virtual ICollection<File> Files { get; set; } = new List<File>();
|
public virtual ICollection<File> Files { get; set; } = new List<File>();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public partial class User
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户昵称
|
/// 用户昵称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? NickName { get; set; } = null!;
|
public string? NickName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户在线状态
|
/// 用户在线状态
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using IM_API.Configs;
|
|||||||
using IM_API.Filters;
|
using IM_API.Filters;
|
||||||
using IM_API.Hubs;
|
using IM_API.Hubs;
|
||||||
using IM_API.Models;
|
using IM_API.Models;
|
||||||
|
using IM_API.Tools;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
@@ -33,6 +34,8 @@ namespace IM_API
|
|||||||
var redis = ConnectionMultiplexer.Connect(redisConStr);
|
var redis = ConnectionMultiplexer.Connect(redisConStr);
|
||||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redis);
|
builder.Services.AddSingleton<IConnectionMultiplexer>(redis);
|
||||||
|
|
||||||
|
builder.Services.AddRabbitMQ(configuration.GetSection("RabbitMqOptions").Get<RabbitMqOptions>());
|
||||||
|
|
||||||
builder.Services.AddAllService(configuration);
|
builder.Services.AddAllService(configuration);
|
||||||
|
|
||||||
builder.Services.AddSignalR();
|
builder.Services.AddSignalR();
|
||||||
@@ -44,7 +47,13 @@ namespace IM_API
|
|||||||
policy.AllowAnyHeader()
|
policy.AllowAnyHeader()
|
||||||
.AllowAnyMethod()
|
.AllowAnyMethod()
|
||||||
.AllowAnyHeader()
|
.AllowAnyHeader()
|
||||||
.AllowAnyOrigin();
|
.AllowCredentials()
|
||||||
|
.SetIsOriginAllowed(origin =>
|
||||||
|
{
|
||||||
|
// 允许所有来自本地或特定网段的请求
|
||||||
|
var host = new Uri(origin).Host;
|
||||||
|
return host == "localhost" || host.StartsWith("192.168.");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//凭证处理
|
//凭证处理
|
||||||
@@ -86,11 +95,7 @@ namespace IM_API
|
|||||||
context.Token = accessToken;
|
context.Token = accessToken;
|
||||||
}
|
}
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
},
|
||||||
};
|
|
||||||
|
|
||||||
options.Events = new JwtBearerEvents
|
|
||||||
{
|
|
||||||
OnAuthenticationFailed = context =>
|
OnAuthenticationFailed = context =>
|
||||||
{
|
{
|
||||||
Console.WriteLine("Authentication failed: " + context.Exception.Message);
|
Console.WriteLine("Authentication failed: " + context.Exception.Message);
|
||||||
@@ -101,7 +106,12 @@ namespace IM_API
|
|||||||
builder.Services.AddControllers(options =>
|
builder.Services.AddControllers(options =>
|
||||||
{
|
{
|
||||||
options.Filters.Add<GlobalExceptionFilter>();
|
options.Filters.Add<GlobalExceptionFilter>();
|
||||||
|
}).AddJsonOptions(options =>
|
||||||
|
{
|
||||||
|
// 保持 ISO 8601 格式
|
||||||
|
options.JsonSerializerOptions.Converters.Add(new UtcDateTimeConverter());
|
||||||
});
|
});
|
||||||
|
builder.Services.AddModelValidation(configuration);
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen();
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using IM_API.Dtos;
|
||||||
|
using IM_API.Exceptions;
|
||||||
|
using IM_API.Interface.Services;
|
||||||
|
using IM_API.Models;
|
||||||
|
using IM_API.Tools;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace IM_API.Services
|
||||||
|
{
|
||||||
|
public class ConversationService : IConversationService
|
||||||
|
{
|
||||||
|
private readonly ImContext _context;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
public ConversationService(ImContext context, IMapper mapper)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
#region 删除用户会话
|
||||||
|
public async Task<bool> ClearConversationsAsync(int userId)
|
||||||
|
{
|
||||||
|
await _context.Conversations.Where(x => x.UserId == userId).ExecuteDeleteAsync();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#region 获取用户会话列表
|
||||||
|
public async Task<List<ConversationDto>> GetConversationsAsync(int userId)
|
||||||
|
{
|
||||||
|
// 1. 获取私聊会话
|
||||||
|
var privateList = await (from c in _context.Conversations
|
||||||
|
join f in _context.Friends on new { c.UserId, c.TargetId }
|
||||||
|
equals new { UserId = f.UserId, TargetId = f.FriendId }
|
||||||
|
where c.UserId == userId && c.ChatType == (int)ChatType.PRIVATE
|
||||||
|
select new { c, f.Avatar, f.RemarkName })
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
// 2. 获取群聊会话
|
||||||
|
var groupList = await (from c in _context.Conversations
|
||||||
|
join g in _context.Groups on c.TargetId equals g.Id
|
||||||
|
where c.UserId == userId && c.ChatType == (int)ChatType.GROUP
|
||||||
|
select new { c, g.Avatar, g.Name })
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var privateDtos = privateList.Select(x =>
|
||||||
|
{
|
||||||
|
var dto = _mapper.Map<ConversationDto>(x.c);
|
||||||
|
dto.TargetAvatar = x.Avatar;
|
||||||
|
dto.TargetName = x.RemarkName;
|
||||||
|
return dto;
|
||||||
|
});
|
||||||
|
|
||||||
|
var groupDtos = groupList.Select(x =>
|
||||||
|
{
|
||||||
|
var dto = _mapper.Map<ConversationDto>(x.c);
|
||||||
|
dto.TargetAvatar = x.Avatar;
|
||||||
|
dto.TargetName = x.Name;
|
||||||
|
return dto;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 4. 合并并排序
|
||||||
|
return privateDtos.Concat(groupDtos)
|
||||||
|
.OrderByDescending(x => x.DateTime)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region 删除单个会话
|
||||||
|
public async Task<bool> DeleteConversationAsync(int conversationId)
|
||||||
|
{
|
||||||
|
var conversation = await _context.Conversations.FirstOrDefaultAsync(x => x.Id == conversationId);
|
||||||
|
if (conversation == null) throw new BaseException(CodeDefine.CONVERSATION_NOT_FOUND);
|
||||||
|
_context.Conversations.Remove(conversation);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#region 获取用户所有统一聊天凭证
|
||||||
|
public async Task<List<string>> GetUserAllStreamKeyAsync(int userId)
|
||||||
|
{
|
||||||
|
return await _context.Conversations.Where(x => x.UserId == userId)
|
||||||
|
.Select(x => x.StreamKey)
|
||||||
|
.Distinct()
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 获取单个会话信息
|
||||||
|
public async Task<ConversationDto> GetConversationByIdAsync(int userId, int conversationId)
|
||||||
|
{
|
||||||
|
var conversation = await _context.Conversations
|
||||||
|
.Include(x => x.LastReadMessage)
|
||||||
|
.FirstOrDefaultAsync(
|
||||||
|
x => x.UserId == userId && x.Id == conversationId
|
||||||
|
);
|
||||||
|
if (conversation is null) throw new BaseException(CodeDefine.CONVERSATION_NOT_FOUND);
|
||||||
|
var dto = _mapper.Map<ConversationDto>(conversation);
|
||||||
|
//dto.LastReadMessage = _mapper.Map<MessageBaseDto>(conversation);
|
||||||
|
if(conversation.ChatType == (int)ChatType.PRIVATE)
|
||||||
|
{
|
||||||
|
var friendInfo = await _context.Friends.FirstOrDefaultAsync(
|
||||||
|
x => x.UserId == userId && x.FriendId == conversation.TargetId
|
||||||
|
);
|
||||||
|
if (friendInfo is null) throw new BaseException(CodeDefine.FRIEND_RELATION_NOT_FOUND);
|
||||||
|
_mapper.Map(friendInfo,dto);
|
||||||
|
}
|
||||||
|
if(conversation.ChatType == (int)ChatType.GROUP)
|
||||||
|
{
|
||||||
|
var groupInfo = await _context.Groups.FirstOrDefaultAsync(
|
||||||
|
x => x.Id == conversation.TargetId
|
||||||
|
);
|
||||||
|
if (groupInfo is null) throw new BaseException(CodeDefine.GROUP_NOT_FOUND);
|
||||||
|
_mapper.Map(groupInfo, dto);
|
||||||
|
}
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public async Task<bool> ClearUnreadCountAsync(int userId, int conversationId)
|
||||||
|
{
|
||||||
|
var conversation = await _context.Conversations.FirstOrDefaultAsync(x => x.UserId == userId && x.Id == conversationId);
|
||||||
|
if (conversation is null) throw new BaseException(CodeDefine.CONVERSATION_NOT_FOUND);
|
||||||
|
var message = await _context.Messages
|
||||||
|
.Where(x => x.StreamKey == conversation.StreamKey)
|
||||||
|
.OrderByDescending(x => x.Id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
conversation.LastReadMessage = message;
|
||||||
|
conversation.UnreadCount = 0;
|
||||||
|
_context.Conversations.Update(conversation);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,33 +63,39 @@ namespace IM_API.Services
|
|||||||
|
|
||||||
public async Task<List<FriendInfoDto>> GetFriendListAsync(int userId, int page, int limit, bool desc)
|
public async Task<List<FriendInfoDto>> GetFriendListAsync(int userId, int page, int limit, bool desc)
|
||||||
{
|
{
|
||||||
var query = _context.Friends.Where(x => x.UserId == userId && x.Status == (sbyte)FriendStatus.Added);
|
var query = _context.Friends.Include(u => u.FriendNavigation).Where(x => x.UserId == userId && x.Status == (sbyte)FriendStatus.Added);
|
||||||
if (desc)
|
if (desc)
|
||||||
{
|
{
|
||||||
query = query.OrderByDescending(x => x.UserId);
|
query = query.OrderByDescending(x => x.UserId);
|
||||||
}
|
}
|
||||||
var friendList = await query.Skip((page - 1 * limit)).Take(limit).ToListAsync();
|
var friendList = await query.Skip(((page - 1) * limit)).Take(limit).ToListAsync();
|
||||||
return _mapper.Map<List<FriendInfoDto>>(friendList);
|
return _mapper.Map<List<FriendInfoDto>>(friendList);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region 获取好友请求列表
|
#region 获取好友请求列表
|
||||||
public async Task<List<FriendRequest>> GetFriendRequestListAsync(int userId, bool isReceived, int page, int limit, bool desc)
|
public async Task<List<FriendRequestResDto>> GetFriendRequestListAsync(int userId, int page, int limit, bool desc)
|
||||||
{
|
{
|
||||||
var query = _context.FriendRequests.AsQueryable();
|
var query = _context.FriendRequests
|
||||||
//是否为请求方
|
.Include(x => x.ResponseUserNavigation)
|
||||||
if (isReceived)
|
.Include(x => x.RequestUserNavigation)
|
||||||
{
|
.Where(
|
||||||
query = _context.FriendRequests.Where(x => x.ResponseUser == userId);
|
x => (x.ResponseUser == userId) ||
|
||||||
}
|
x.RequestUser == userId
|
||||||
else
|
)
|
||||||
{
|
.Select(s => new FriendRequestResDto
|
||||||
query = _context.FriendRequests.Where(x => x.RequestUser == userId);
|
|
||||||
}
|
|
||||||
if (desc)
|
|
||||||
{
|
{
|
||||||
|
Id = s.Id,
|
||||||
|
RequestUser = s.RequestUser,
|
||||||
|
ResponseUser = s.ResponseUser,
|
||||||
|
Avatar = s.RequestUser == userId ? s.ResponseUserNavigation.Avatar : s.RequestUserNavigation.Avatar,
|
||||||
|
Created = s.Created,
|
||||||
|
NickName = s.RequestUser == userId ? s.ResponseUserNavigation.NickName : s.RequestUserNavigation.NickName,
|
||||||
|
Description = s.Description,
|
||||||
|
State = (FriendRequestState)s.State
|
||||||
|
})
|
||||||
|
;
|
||||||
query = query.OrderByDescending(x => x.Id);
|
query = query.OrderByDescending(x => x.Id);
|
||||||
}
|
var friendRequestList = await query.Skip(((page - 1) * limit)).Take(limit).ToListAsync();
|
||||||
var friendRequestList = await query.Skip((page - 1 * limit)).Take(limit).ToListAsync();
|
|
||||||
return friendRequestList;
|
return friendRequestList;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -154,18 +160,17 @@ namespace IM_API.Services
|
|||||||
if (alreadyExists)
|
if (alreadyExists)
|
||||||
throw new BaseException(CodeDefine.FRIEND_REQUEST_EXISTS);
|
throw new BaseException(CodeDefine.FRIEND_REQUEST_EXISTS);
|
||||||
|
|
||||||
|
var friendShip = await _context.Friends.FirstOrDefaultAsync(x => x.UserId == dto.FromUserId && x.FriendId == dto.ToUserId);
|
||||||
|
|
||||||
//检查是否被对方拉黑
|
//检查是否被对方拉黑
|
||||||
bool isBlocked = await _context.Friends.AnyAsync(x =>
|
bool isBlocked = friendShip != null && friendShip.StatusEnum == FriendStatus.Blocked;
|
||||||
x.UserId == dto.FromUserId && x.FriendId == dto.ToUserId && x.Status == (sbyte)FriendStatus.Blocked
|
|
||||||
);
|
|
||||||
if (isBlocked)
|
if (isBlocked)
|
||||||
throw new BaseException(CodeDefine.FRIEND_REQUEST_REJECTED);
|
throw new BaseException(CodeDefine.FRIEND_REQUEST_REJECTED);
|
||||||
|
if (friendShip != null)
|
||||||
|
throw new BaseException(CodeDefine.ALREADY_FRIENDS);
|
||||||
//生成实体
|
//生成实体
|
||||||
var friendRequst = _mapper.Map<FriendRequest>(dto);
|
var friendRequst = _mapper.Map<FriendRequest>(dto);
|
||||||
var friend = _mapper.Map<Friend>(friendRequst);
|
|
||||||
_context.FriendRequests.Add(friendRequst);
|
_context.FriendRequests.Add(friendRequst);
|
||||||
_context.Friends.Add(friend);
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using IM_API.Application.Interfaces;
|
||||||
|
using IM_API.Domain.Events;
|
||||||
using IM_API.Dtos;
|
using IM_API.Dtos;
|
||||||
using IM_API.Exceptions;
|
using IM_API.Exceptions;
|
||||||
using IM_API.Interface.Services;
|
using IM_API.Interface.Services;
|
||||||
using IM_API.Models;
|
using IM_API.Models;
|
||||||
using IM_API.Tools;
|
using IM_API.Tools;
|
||||||
|
using MassTransit;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace IM_API.Services
|
namespace IM_API.Services
|
||||||
@@ -13,21 +16,53 @@ namespace IM_API.Services
|
|||||||
private readonly ImContext _context;
|
private readonly ImContext _context;
|
||||||
private readonly ILogger<MessageService> _logger;
|
private readonly ILogger<MessageService> _logger;
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
public MessageService(ImContext context, ILogger<MessageService> logger, IMapper mapper)
|
//废弃,此处已使用rabbitMQ替代
|
||||||
|
//private readonly IEventBus _eventBus;
|
||||||
|
private readonly IPublishEndpoint _endpoint;
|
||||||
|
public MessageService(
|
||||||
|
ImContext context, ILogger<MessageService> logger, IMapper mapper, IEventBus eventBus,
|
||||||
|
IPublishEndpoint publishEndpoint
|
||||||
|
)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
|
//_eventBus = eventBus;
|
||||||
|
_endpoint = publishEndpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<MessageBaseDto>> GetGroupMessagesAsync(int groupId, int page, int pageSize, bool desc)
|
public async Task<List<MessageBaseDto>> GetMessagesAsync(int userId, int conversationId, int? msgId, int? pageSize, bool desc)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
//获取会话信息,用于获取双方聊天的唯一标识streamkey
|
||||||
|
Conversation? conversation = await _context.Conversations.FirstOrDefaultAsync(
|
||||||
|
x => x.Id == conversationId && x.UserId == userId
|
||||||
|
);
|
||||||
|
if (conversation is null) throw new BaseException(CodeDefine.CONVERSATION_NOT_FOUND);
|
||||||
|
var query = _context.Messages.AsQueryable();
|
||||||
|
if(msgId != null)
|
||||||
|
{
|
||||||
|
query = query.Where(
|
||||||
|
x => x.StreamKey == conversation.StreamKey && x.Id < msgId.Value
|
||||||
|
)
|
||||||
|
.OrderByDescending(x => x.Id);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
public Task<List<MessageBaseDto>> GetPrivateMessagesAsync(int userAId, int userBId, int page, int pageSize, bool desc)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
query = query.Where(
|
||||||
|
x => x.StreamKey == conversation.StreamKey && x.Id > conversation.LastReadMessageId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if(pageSize != null)
|
||||||
|
{
|
||||||
|
query = query.Take(pageSize.Value);
|
||||||
|
}
|
||||||
|
var msgList = await query
|
||||||
|
.ToListAsync();
|
||||||
|
msgList = msgList
|
||||||
|
.OrderBy(x => x.Created)
|
||||||
|
.ThenBy(t => t.Id)
|
||||||
|
.ToList();
|
||||||
|
return _mapper.Map<List<MessageBaseDto>>(msgList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<int> GetUnreadCountAsync(int userId)
|
public Task<int> GetUnreadCountAsync(int userId)
|
||||||
@@ -54,21 +89,41 @@ namespace IM_API.Services
|
|||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
#region 发送群消息
|
||||||
public Task<bool> SendGroupMessageAsync(int senderId, int groupId, MessageBaseDto dto)
|
public async Task<MessageBaseDto> SendGroupMessageAsync(int senderId, int groupId, MessageBaseDto dto)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
//判断群存在
|
||||||
}
|
var isExist = await _context.Groups.AnyAsync(x => x.Id == groupId);
|
||||||
|
if (!isExist) throw new BaseException(CodeDefine.GROUP_NOT_FOUND);
|
||||||
|
//判断是否是群成员
|
||||||
|
var isMember = await _context.GroupMembers.AnyAsync(x => x.GroupId == groupId && x.UserId == senderId);
|
||||||
|
if (!isMember) throw new BaseException(CodeDefine.NO_GROUP_PERMISSION);
|
||||||
|
var message = _mapper.Map<Message>(dto);
|
||||||
|
message.Sender = senderId;
|
||||||
|
message.StreamKey = StreamKeyBuilder.Group(
|
||||||
|
|
||||||
public async Task<bool> SendPrivateMessageAsync(int senderId, int receiverId, MessageBaseDto dto)
|
groupId);
|
||||||
|
_context.Messages.Add(message);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
await _endpoint.Publish(_mapper.Map<MessageCreatedEvent>(message));
|
||||||
|
return _mapper.Map<MessageBaseDto>(message);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region 发送私聊消息
|
||||||
|
public async Task<MessageBaseDto> SendPrivateMessageAsync(int senderId, int receiverId, MessageBaseDto dto)
|
||||||
{
|
{
|
||||||
bool isExist = await _context.Friends.AnyAsync(x => x.FriendId == receiverId);
|
bool isExist = await _context.Friends.AnyAsync(x => x.FriendId == receiverId);
|
||||||
if (!isExist) throw new BaseException(CodeDefine.FRIEND_RELATION_NOT_FOUND);
|
if (!isExist) throw new BaseException(CodeDefine.FRIEND_RELATION_NOT_FOUND);
|
||||||
var message = _mapper.Map<Message>(dto);
|
var message = _mapper.Map<Message>(dto);
|
||||||
message.Sender = senderId;
|
message.Sender = senderId;
|
||||||
|
//生成消息流唯一标识符
|
||||||
|
message.StreamKey = StreamKeyBuilder.Private(dto.SenderId, dto.ReceiverId);
|
||||||
_context.Messages.Add(message);
|
_context.Messages.Add(message);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return true;
|
await _endpoint.Publish(_mapper.Map<MessageCreatedEvent>(message));
|
||||||
|
return _mapper.Map<MessageBaseDto>(message);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ namespace IM_API.Services
|
|||||||
if (json.IsNullOrEmpty) return (false,-1);
|
if (json.IsNullOrEmpty) return (false,-1);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var doc = JsonConvert.DeserializeObject<JsonElement>(json);
|
using var doc = JsonDocument.Parse(json.ToString());
|
||||||
var userId = doc.GetProperty("UserId").GetInt32();
|
var userId = doc.RootElement.GetProperty("UserId").GetInt32();
|
||||||
return (true,userId);
|
return (true,userId);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|||||||
@@ -102,5 +102,8 @@
|
|||||||
/// <summary>后台日志写入失败</summary>
|
/// <summary>后台日志写入失败</summary>
|
||||||
public static CodeDefine OPERATION_LOG_FAILED = new CodeDefine(3004, "操作记录失败");
|
public static CodeDefine OPERATION_LOG_FAILED = new CodeDefine(3004, "操作记录失败");
|
||||||
|
|
||||||
|
// 3.9 会话相关错误(3100 ~ 3199)
|
||||||
|
/// <summary>发送时异常</summary>
|
||||||
|
public static CodeDefine CONVERSATION_NOT_FOUND = new CodeDefine(3100, "会话不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace IM_API.Tools
|
||||||
|
{
|
||||||
|
public class SignalRMethodDefine
|
||||||
|
{
|
||||||
|
public static string ReceiveMessage = "ReceiveMessage";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace IM_API.Tools
|
||||||
|
{
|
||||||
|
public static class StreamKeyBuilder
|
||||||
|
{
|
||||||
|
public static string Private(long a, long b)
|
||||||
|
{
|
||||||
|
if (a <= 0 || b <= 0) throw new ArgumentException();
|
||||||
|
return $"p:{(a < b ? $"{a}_{b}" : $"{b}_{a}")}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Group(long groupId)
|
||||||
|
{
|
||||||
|
if (groupId <= 0) throw new ArgumentException();
|
||||||
|
return $"g:{groupId}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace IM_API.Tools
|
||||||
|
{
|
||||||
|
public class UtcDateTimeConverter : System.Text.Json.Serialization.JsonConverter<DateTime>
|
||||||
|
{
|
||||||
|
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
=> reader.GetDateTime();
|
||||||
|
|
||||||
|
public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
// 如果 Kind 已经是 Utc,直接输出。
|
||||||
|
// 如果不是,先 SpecifyKind 再输出,确保不会发生时区偏移计算
|
||||||
|
var utcDate = value.Kind == DateTimeKind.Utc ? value : DateTime.SpecifyKind(value, DateTimeKind.Utc);
|
||||||
|
writer.WriteStringValue(utcDate.ToString("yyyy-MM-ddTHH:mm:ssZ"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,5 +16,11 @@
|
|||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "Server=frp-era.com;Port=26582;Database=IM;User=product;Password=12345678;",
|
"DefaultConnection": "Server=frp-era.com;Port=26582;Database=IM;User=product;Password=12345678;",
|
||||||
"Redis": "192.168.5.100:6379"
|
"Redis": "192.168.5.100:6379"
|
||||||
|
},
|
||||||
|
"RabbitMQOptions": {
|
||||||
|
"Host": "192.168.5.100",
|
||||||
|
"Port": 5672,
|
||||||
|
"Username": "test",
|
||||||
|
"Password": "123456"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,3 +71,12 @@ public WeatherForecastController(IDemo demo)
|
|||||||
## 4. 模型类字段使用规范
|
## 4. 模型类字段使用规范
|
||||||
|
|
||||||
### 4.1 类中状态相关字段,例如:Status,返回值为sbyte。若类中有同名字段+后缀Enum,则优先使用后者,StatusEnum。
|
### 4.1 类中状态相关字段,例如:Status,返回值为sbyte。若类中有同名字段+后缀Enum,则优先使用后者,StatusEnum。
|
||||||
|
|
||||||
|
## 5.数据库相关
|
||||||
|
|
||||||
|
### 5.1 若数据库表结构更新,请在软件包控制台执行如下命令:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
Scaffold-DbContext "Name=ConnectionStrings:DefaultConnection" Pomelo.EntityFrameworkCore.MySql -OutputDir Models -Context ImContext -Force -NoOnConfiguring
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
maven { url = uri("https://maven.aliyun.com/repository/google") }
|
||||||
|
maven { url = uri("https://maven.aliyun.com/repository/public") }
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,6 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
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
|
||||||
@@ -11,6 +11,8 @@ pluginManagement {
|
|||||||
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
maven { url = uri("https://maven.aliyun.com/repository/google") }
|
||||||
|
maven { url = uri("https://maven.aliyun.com/repository/public") }
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
|||||||
@@ -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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
class AppColors {
|
||||||
|
static const Color primaryColor = Color(0xFF4FDBFF); // 微信绿
|
||||||
|
}
|
||||||
@@ -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()
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
|
||||||
|
);
|
||||||
@@ -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),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+5
-173
@@ -1,178 +1,10 @@
|
|||||||
|
import 'package:flutter_web_plugins/url_strategy.dart';
|
||||||
|
import 'package:app/app.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
void main() => runApp(
|
void main(List<String> args){
|
||||||
const MaterialApp(home: IMLoginPage(), debugShowCheckedModeBanner: false),
|
|
||||||
);
|
|
||||||
|
|
||||||
class IMLoginPage extends StatefulWidget {
|
usePathUrlStrategy();
|
||||||
const IMLoginPage({super.key});
|
|
||||||
|
|
||||||
@override
|
runApp(const MyApp());
|
||||||
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),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+46
-25
@@ -6,7 +6,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
|
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.13.0"
|
version: "2.13.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
@@ -14,7 +14,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
|
sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.2"
|
||||||
characters:
|
characters:
|
||||||
@@ -22,7 +22,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: characters
|
name: characters
|
||||||
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
|
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.4.0"
|
||||||
clock:
|
clock:
|
||||||
@@ -30,7 +30,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: clock
|
name: clock
|
||||||
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
|
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.2"
|
version: "1.1.2"
|
||||||
collection:
|
collection:
|
||||||
@@ -38,7 +38,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.19.1"
|
version: "1.19.1"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
@@ -46,7 +46,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: cupertino_icons
|
name: cupertino_icons
|
||||||
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
|
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.8"
|
version: "1.0.8"
|
||||||
fake_async:
|
fake_async:
|
||||||
@@ -54,7 +54,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: fake_async
|
name: fake_async
|
||||||
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
|
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.3"
|
version: "1.3.3"
|
||||||
flutter:
|
flutter:
|
||||||
@@ -67,7 +67,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: flutter_lints
|
name: flutter_lints
|
||||||
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
|
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.0"
|
version: "6.0.0"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
@@ -75,12 +75,25 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
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:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: leak_tracker
|
name: leak_tracker
|
||||||
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
|
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "11.0.2"
|
version: "11.0.2"
|
||||||
leak_tracker_flutter_testing:
|
leak_tracker_flutter_testing:
|
||||||
@@ -88,7 +101,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: leak_tracker_flutter_testing
|
name: leak_tracker_flutter_testing
|
||||||
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
|
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.10"
|
version: "3.0.10"
|
||||||
leak_tracker_testing:
|
leak_tracker_testing:
|
||||||
@@ -96,7 +109,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: leak_tracker_testing
|
name: leak_tracker_testing
|
||||||
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
|
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.2"
|
version: "3.0.2"
|
||||||
lints:
|
lints:
|
||||||
@@ -104,15 +117,23 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: lints
|
name: lints
|
||||||
sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0
|
sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.0"
|
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:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
|
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.17"
|
version: "0.12.17"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
@@ -120,7 +141,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
|
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.11.1"
|
version: "0.11.1"
|
||||||
meta:
|
meta:
|
||||||
@@ -128,7 +149,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
|
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.17.0"
|
version: "1.17.0"
|
||||||
path:
|
path:
|
||||||
@@ -136,7 +157,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
|
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.1"
|
version: "1.9.1"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
@@ -149,7 +170,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: source_span
|
name: source_span
|
||||||
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
|
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.1"
|
version: "1.10.1"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
@@ -157,7 +178,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
|
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.12.1"
|
version: "1.12.1"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
@@ -165,7 +186,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
|
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.4"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
@@ -173,7 +194,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: string_scanner
|
name: string_scanner
|
||||||
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
|
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.1"
|
version: "1.4.1"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
@@ -181,7 +202,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: term_glyph
|
name: term_glyph
|
||||||
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
|
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.2"
|
version: "1.2.2"
|
||||||
test_api:
|
test_api:
|
||||||
@@ -189,7 +210,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
|
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.7"
|
version: "0.7.7"
|
||||||
vector_math:
|
vector_math:
|
||||||
@@ -197,7 +218,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
|
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.2.0"
|
||||||
vm_service:
|
vm_service:
|
||||||
@@ -205,9 +226,9 @@ packages:
|
|||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
|
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
|
||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "15.0.2"
|
version: "15.0.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.10.4 <4.0.0"
|
dart: ">=3.10.4 <4.0.0"
|
||||||
flutter: ">=3.18.0-18.0.pre.54"
|
flutter: ">=3.35.0"
|
||||||
|
|||||||
@@ -31,9 +31,13 @@ dependencies:
|
|||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
|
flutter_web_plugins:
|
||||||
|
sdk: flutter
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.8
|
cupertino_icons: ^1.0.8
|
||||||
|
go_router: ^17.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@@ -5,15 +5,14 @@
|
|||||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
// 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.
|
// 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/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
import 'package:app/main.dart';
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||||
// Build our app and trigger a frame.
|
// Build our app and trigger a frame.
|
||||||
await tester.pumpWidget(const IMLoginPage());
|
await tester.pumpWidget(const LoginPage());
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
// Verify that our counter starts at 0.
|
||||||
expect(find.text('0'), findsOneWidget);
|
expect(find.text('0'), findsOneWidget);
|
||||||
|
|||||||
+4
-1
@@ -1 +1,4 @@
|
|||||||
VITE_API_BASE_URL = http://192.168.5.116:7070/api
|
#VITE_API_BASE_URL = http://localhost:5202/api
|
||||||
|
#VITE_SIGNALR_BASE_URL = http://localhost:5202/chat
|
||||||
|
VITE_API_BASE_URL = https://im.test.nxsir.cn/api
|
||||||
|
VITE_SIGNALR_BASE_URL = https://im.test.nxsir.cn/chat/
|
||||||
Generated
+202
-3
@@ -8,10 +8,12 @@
|
|||||||
"name": "web",
|
"name": "web",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@microsoft/signalr": "^10.0.0",
|
||||||
"@vuelidate/core": "^2.0.3",
|
"@vuelidate/core": "^2.0.3",
|
||||||
"@vuelidate/validators": "^2.0.4",
|
"@vuelidate/validators": "^2.0.4",
|
||||||
"axios": "^1.13.2",
|
"axios": "^1.13.2",
|
||||||
"feather-icons": "^4.29.2",
|
"feather-icons": "^4.29.2",
|
||||||
|
"idb": "^8.0.3",
|
||||||
"pinia": "^3.0.3",
|
"pinia": "^3.0.3",
|
||||||
"vee-validate": "^4.15.1",
|
"vee-validate": "^4.15.1",
|
||||||
"vue": "^3.5.22",
|
"vue": "^3.5.22",
|
||||||
@@ -103,6 +105,7 @@
|
|||||||
"integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==",
|
"integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.27.1",
|
"@babel/code-frame": "^7.27.1",
|
||||||
"@babel/generator": "^7.28.3",
|
"@babel/generator": "^7.28.3",
|
||||||
@@ -655,6 +658,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
@@ -701,6 +705,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
@@ -1458,6 +1463,40 @@
|
|||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@microsoft/signalr": {
|
||||||
|
"version": "10.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-10.0.0.tgz",
|
||||||
|
"integrity": "sha512-0BRqz/uCx3JdrOqiqgFhih/+hfTERaUfCZXFB52uMaZJrKaPRzHzMuqVsJC/V3pt7NozcNXGspjKiQEK+X7P2w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"abort-controller": "^3.0.0",
|
||||||
|
"eventsource": "^2.0.2",
|
||||||
|
"fetch-cookie": "^2.0.3",
|
||||||
|
"node-fetch": "^2.6.7",
|
||||||
|
"ws": "^7.5.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@microsoft/signalr/node_modules/ws": {
|
||||||
|
"version": "7.5.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
|
||||||
|
"integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.3.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"bufferutil": "^4.0.1",
|
||||||
|
"utf-8-validate": "^5.0.2"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"bufferutil": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"utf-8-validate": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@nodelib/fs.scandir": {
|
"node_modules/@nodelib/fs.scandir": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||||
@@ -2613,12 +2652,25 @@
|
|||||||
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
|
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/abort-controller": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"event-target-shim": "^5.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/acorn": {
|
"node_modules/acorn": {
|
||||||
"version": "8.15.0",
|
"version": "8.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
||||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -2822,6 +2874,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.8.9",
|
"baseline-browser-mapping": "^2.8.9",
|
||||||
"caniuse-lite": "^1.0.30001746",
|
"caniuse-lite": "^1.0.30001746",
|
||||||
@@ -3436,6 +3489,7 @@
|
|||||||
"integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==",
|
"integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.8.0",
|
"@eslint-community/eslint-utils": "^4.8.0",
|
||||||
"@eslint-community/regexpp": "^4.12.1",
|
"@eslint-community/regexpp": "^4.12.1",
|
||||||
@@ -3497,6 +3551,7 @@
|
|||||||
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
|
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"eslint-config-prettier": "bin/cli.js"
|
"eslint-config-prettier": "bin/cli.js"
|
||||||
},
|
},
|
||||||
@@ -3716,6 +3771,24 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/event-target-shim": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/eventsource": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/execa": {
|
"node_modules/execa": {
|
||||||
"version": "9.6.0",
|
"version": "9.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/execa/-/execa-9.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/execa/-/execa-9.6.0.tgz",
|
||||||
@@ -3831,6 +3904,31 @@
|
|||||||
"core-js": "^3.1.3"
|
"core-js": "^3.1.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/fetch-cookie": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-h9AgfjURuCgA2+2ISl8GbavpUdR+WGAM2McW/ovn4tVccegp8ZqCKWSBR8uRdM8dDNlx5WdKRWxBYUwteLDCNQ==",
|
||||||
|
"license": "Unlicense",
|
||||||
|
"dependencies": {
|
||||||
|
"set-cookie-parser": "^2.4.8",
|
||||||
|
"tough-cookie": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fetch-cookie/node_modules/tough-cookie": {
|
||||||
|
"version": "4.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz",
|
||||||
|
"integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"psl": "^1.1.33",
|
||||||
|
"punycode": "^2.1.1",
|
||||||
|
"universalify": "^0.2.0",
|
||||||
|
"url-parse": "^1.5.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/figures": {
|
"node_modules/figures": {
|
||||||
"version": "6.1.0",
|
"version": "6.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/figures/-/figures-6.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/figures/-/figures-6.1.0.tgz",
|
||||||
@@ -4230,6 +4328,12 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/idb": {
|
||||||
|
"version": "8.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/idb/-/idb-8.0.3.tgz",
|
||||||
|
"integrity": "sha512-LtwtVyVYO5BqRvcsKuB2iUMnHwPVByPCXFXOpuU96IZPPoPN6xjOGxZQ74pgSVVLQWtUOYgyeL4GE98BY5D3wg==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
"node_modules/ignore": {
|
"node_modules/ignore": {
|
||||||
"version": "5.3.2",
|
"version": "5.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
|
||||||
@@ -4813,6 +4917,48 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/node-fetch": {
|
||||||
|
"version": "2.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||||
|
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"whatwg-url": "^5.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "4.x || >=6.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"encoding": "^0.1.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"encoding": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/node-fetch/node_modules/tr46": {
|
||||||
|
"version": "0.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||||
|
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/node-fetch/node_modules/webidl-conversions": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
|
||||||
|
"license": "BSD-2-Clause"
|
||||||
|
},
|
||||||
|
"node_modules/node-fetch/node_modules/whatwg-url": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tr46": "~0.0.3",
|
||||||
|
"webidl-conversions": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/node-releases": {
|
"node_modules/node-releases": {
|
||||||
"version": "2.0.23",
|
"version": "2.0.23",
|
||||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.23.tgz",
|
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.23.tgz",
|
||||||
@@ -5127,6 +5273,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.11",
|
"nanoid": "^3.3.11",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
@@ -5166,6 +5313,7 @@
|
|||||||
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
|
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"prettier": "bin/prettier.cjs"
|
"prettier": "bin/prettier.cjs"
|
||||||
},
|
},
|
||||||
@@ -5224,16 +5372,33 @@
|
|||||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/psl": {
|
||||||
|
"version": "1.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz",
|
||||||
|
"integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"punycode": "^2.3.1"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/lupomontero"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/punycode": {
|
"node_modules/punycode": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/querystringify": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/queue-microtask": {
|
"node_modules/queue-microtask": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||||
@@ -5265,6 +5430,12 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/requires-port": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/resolve-from": {
|
"node_modules/resolve-from": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||||
@@ -5411,6 +5582,12 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/set-cookie-parser": {
|
||||||
|
"version": "2.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz",
|
||||||
|
"integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/shebang-command": {
|
"node_modules/shebang-command": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||||
@@ -5760,6 +5937,7 @@
|
|||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -5938,6 +6116,15 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/universalify": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/unplugin-utils": {
|
"node_modules/unplugin-utils": {
|
||||||
"version": "0.3.1",
|
"version": "0.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/unplugin-utils/-/unplugin-utils-0.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/unplugin-utils/-/unplugin-utils-0.3.1.tgz",
|
||||||
@@ -6009,6 +6196,16 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/url-parse": {
|
||||||
|
"version": "1.5.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||||
|
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"querystringify": "^2.1.1",
|
||||||
|
"requires-port": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/util-deprecate": {
|
"node_modules/util-deprecate": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
@@ -6035,6 +6232,7 @@
|
|||||||
"integrity": "sha512-ITcnkFeR3+fI8P1wMgItjGrR10170d8auB4EpMLPqmx6uxElH3a/hHGQabSHKdqd4FXWO1nFIp9rRn7JQ34ACQ==",
|
"integrity": "sha512-ITcnkFeR3+fI8P1wMgItjGrR10170d8auB4EpMLPqmx6uxElH3a/hHGQabSHKdqd4FXWO1nFIp9rRn7JQ34ACQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.0",
|
||||||
"fdir": "^6.5.0",
|
"fdir": "^6.5.0",
|
||||||
@@ -6296,6 +6494,7 @@
|
|||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -6309,6 +6508,7 @@
|
|||||||
"integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==",
|
"integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/chai": "^5.2.2",
|
"@types/chai": "^5.2.2",
|
||||||
"@vitest/expect": "3.2.4",
|
"@vitest/expect": "3.2.4",
|
||||||
@@ -6394,6 +6594,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.22.tgz",
|
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.22.tgz",
|
||||||
"integrity": "sha512-toaZjQ3a/G/mYaLSbV+QsQhIdMo9x5rrqIpYRObsJ6T/J+RyCSFwN2LHNVH9v8uIcljDNa3QzPVdv3Y6b9hAJQ==",
|
"integrity": "sha512-toaZjQ3a/G/mYaLSbV+QsQhIdMo9x5rrqIpYRObsJ6T/J+RyCSFwN2LHNVH9v8uIcljDNa3QzPVdv3Y6b9hAJQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.5.22",
|
"@vue/compiler-dom": "3.5.22",
|
||||||
"@vue/compiler-sfc": "3.5.22",
|
"@vue/compiler-sfc": "3.5.22",
|
||||||
@@ -6423,7 +6624,6 @@
|
|||||||
"integrity": "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw==",
|
"integrity": "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "^4.4.0",
|
"debug": "^4.4.0",
|
||||||
"eslint-scope": "^8.2.0",
|
"eslint-scope": "^8.2.0",
|
||||||
@@ -6448,7 +6648,6 @@
|
|||||||
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
|
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"node": "^20.19.0 || >=22.12.0"
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite --host",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test:unit": "vitest",
|
"test:unit": "vitest",
|
||||||
@@ -15,10 +15,12 @@
|
|||||||
"format": "prettier --write src/"
|
"format": "prettier --write src/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@microsoft/signalr": "^10.0.0",
|
||||||
"@vuelidate/core": "^2.0.3",
|
"@vuelidate/core": "^2.0.3",
|
||||||
"@vuelidate/validators": "^2.0.4",
|
"@vuelidate/validators": "^2.0.4",
|
||||||
"axios": "^1.13.2",
|
"axios": "^1.13.2",
|
||||||
"feather-icons": "^4.29.2",
|
"feather-icons": "^4.29.2",
|
||||||
|
"idb": "^8.0.3",
|
||||||
"pinia": "^3.0.3",
|
"pinia": "^3.0.3",
|
||||||
"vee-validate": "^4.15.1",
|
"vee-validate": "^4.15.1",
|
||||||
"vue": "^3.5.22",
|
"vue": "^3.5.22",
|
||||||
|
|||||||
@@ -7,8 +7,19 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import Alert from '@/components/messages/Alert.vue';
|
import Alert from '@/components/messages/Alert.vue';
|
||||||
</script>
|
import { onMounted } from 'vue';
|
||||||
|
import { useAuthStore } from './stores/auth';
|
||||||
|
//import { useSignalRStore } from './stores/signalr';
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const { useSignalRStore } = await import('./stores/signalr');
|
||||||
|
const authStore = useAuthStore();
|
||||||
|
const signalRStore = useSignalRStore();
|
||||||
|
if(authStore.token){
|
||||||
|
signalRStore.initSignalR();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
|
|||||||
@@ -0,0 +1,180 @@
|
|||||||
|
<template>
|
||||||
|
<div class="add-menu-container" v-click-outside="closeMenu">
|
||||||
|
<button class="add-btn" :class="{ active: isShow }" @click="toggleMenu">
|
||||||
|
<span class="plus-icon">+</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<Transition name="pop">
|
||||||
|
<div v-if="isShow" class="menu-card">
|
||||||
|
<div class="arrow"></div>
|
||||||
|
|
||||||
|
<div class="menu-list">
|
||||||
|
<div class="menu-item" v-for="(item, index) in props.menuList" :key="index" @click="handleAction(item.action)">
|
||||||
|
<i class="icon" v-html="item.icon"></i>
|
||||||
|
<span>{{item.text}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, defineProps, onMounted, defineEmits } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
menuList: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['actionActive'])
|
||||||
|
|
||||||
|
const isShow = ref(false);
|
||||||
|
|
||||||
|
const toggleMenu = () => {
|
||||||
|
isShow.value = !isShow.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeMenu = () => {
|
||||||
|
isShow.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAction = (type) => {
|
||||||
|
emit('actionActive', type);
|
||||||
|
isShow.value = false; // 点击后关闭
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义指令:点击外部区域关闭菜单
|
||||||
|
* 也可以使用第三方库如 @vueuse/core 的 onClickOutside
|
||||||
|
*/
|
||||||
|
const vClickOutside = {
|
||||||
|
mounted(el, binding) {
|
||||||
|
el.clickOutsideEvent = (event) => {
|
||||||
|
if (!(el === event.target || el.contains(event.target))) {
|
||||||
|
binding.value();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener('click', el.clickOutsideEvent);
|
||||||
|
},
|
||||||
|
unmounted(el) {
|
||||||
|
document.removeEventListener('click', el.clickOutsideEvent);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.add-menu-container {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 加号按钮样式 */
|
||||||
|
.add-btn {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
background: #dbdbdb;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-btn:hover {
|
||||||
|
background: #cccbcb;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
.add-btn.active {
|
||||||
|
background: #007aff;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
.plus-icon {
|
||||||
|
font-size: 22px;
|
||||||
|
line-height: 1;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹出卡片容器 */
|
||||||
|
.menu-card {
|
||||||
|
position: absolute;
|
||||||
|
top: 45px;
|
||||||
|
right: 0;
|
||||||
|
width: 100px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
||||||
|
z-index: 100;
|
||||||
|
transform-origin: top right;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 小三角 */
|
||||||
|
.arrow {
|
||||||
|
position: absolute;
|
||||||
|
top: -6px;
|
||||||
|
right: 12px;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-left: 6px solid transparent;
|
||||||
|
border-right: 6px solid transparent;
|
||||||
|
border-bottom: 6px solid white;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 列表样式 */
|
||||||
|
.menu-list {
|
||||||
|
padding: 6px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 5px 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.2s;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item:hover {
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item:first-child:hover {
|
||||||
|
border-top-left-radius: 10px;
|
||||||
|
border-top-right-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item:last-child:hover {
|
||||||
|
border-bottom-left-radius: 10px;
|
||||||
|
border-bottom-right-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
margin-right: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
/*width: 20px;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item span {
|
||||||
|
font-size: 12px;
|
||||||
|
/*font-weight: 400;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹出动画 */
|
||||||
|
.pop-enter-active, .pop-leave-active {
|
||||||
|
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pop-enter-from, .pop-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(0.9) translateY(-10px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,256 @@
|
|||||||
|
<template>
|
||||||
|
<div class="modal-overlay" @click.self="$emit('close')">
|
||||||
|
<div class="chat-modal">
|
||||||
|
<div class="modal-header">
|
||||||
|
<div class="header-top">
|
||||||
|
<h3>群聊</h3>
|
||||||
|
<button class="close-btn" @click="$emit('close')">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="search-bar">
|
||||||
|
<input
|
||||||
|
v-model="searchQuery"
|
||||||
|
type="text"
|
||||||
|
placeholder="搜索群组..."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chat-list">
|
||||||
|
<TransitionGroup name="list">
|
||||||
|
<div
|
||||||
|
v-for="group in filteredGroups"
|
||||||
|
:key="group.id"
|
||||||
|
class="chat-item"
|
||||||
|
@click="handleSelect(group)"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="avatar"
|
||||||
|
:style="{ background: group.avatar ? `url(${group.avatar}) center/cover` : group.color }"
|
||||||
|
>
|
||||||
|
{{ group.avatar ? '' : group.name.charAt(0) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chat-info">
|
||||||
|
<div class="chat-name">{{ group.name }}</div>
|
||||||
|
<!--<div class="chat-preview">{{ group.lastMsg }}</div>-->
|
||||||
|
</div>
|
||||||
|
<!--
|
||||||
|
<div class="chat-meta">
|
||||||
|
<span class="time">{{ group.time }}</span>
|
||||||
|
<span v-if="group.unread" class="unread">{{ group.unread }}</span>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</TransitionGroup>
|
||||||
|
|
||||||
|
<div v-if="filteredGroups.length === 0" class="empty-state">
|
||||||
|
未找到相关群聊
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed, defineProps } from 'vue';
|
||||||
|
|
||||||
|
// 检查你的代码,确保 default 是一个返回数组的函数,且逗号、括号一一对应
|
||||||
|
const props = defineProps({
|
||||||
|
initialGroups: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [
|
||||||
|
{ id: 1, name: '产品设计交流群', lastMsg: '张三: 确认一下原型图', time: '14:30', unread: 3, color: 'linear-gradient(45deg, #007AFF, #5AC8FA)' },
|
||||||
|
{ id: 2, name: '技术研发部', lastMsg: '王五: Bug已修复并上线', time: '12:05', unread: 0, color: 'linear-gradient(45deg, #4CD964, #5AC8FA)' },
|
||||||
|
{ id: 3, name: '周末户外徒步', lastMsg: '李四: 记得带雨伞', time: '昨天', unread: 12, color: 'linear-gradient(45deg, #FF9500, #FFCC00)' },
|
||||||
|
{ id: 4, name: 'Family 家族群', lastMsg: '[图片]', time: '周一', unread: 0, color: 'linear-gradient(45deg, #5856D6, #AF52DE)' }, // 确保这里没有多余或缺失的逗号
|
||||||
|
{ id: 5, name: 'Family 家族群', lastMsg: '[图片]', time: '周一', unread: 0, color: 'linear-gradient(45deg, #5856D6, #AF52DE)' },
|
||||||
|
{ id: 6, name: 'Family 家族群', lastMsg: '[图片]', time: '周一', unread: 0, color: 'linear-gradient(45deg, #5856D6, #AF52DE)' },
|
||||||
|
{ id: 7, name: 'Family 家族群', lastMsg: '[图片]', time: '周一', unread: 0, color: 'linear-gradient(45deg, #5856D6, #AF52DE)' },
|
||||||
|
{ id: 8, name: 'Family 家族群', lastMsg: '[图片]', time: '周一', unread: 0, color: 'linear-gradient(45deg, #5856D6, #AF52DE)' },
|
||||||
|
{ id: 9, name: 'Family 家族群', lastMsg: '[图片]', time: '周一', unread: 0, color: 'linear-gradient(45deg, #5856D6, #AF52DE)' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}); // 检查这里是否漏掉了右括号 )
|
||||||
|
|
||||||
|
|
||||||
|
const emit = defineEmits(['close', 'select']);
|
||||||
|
const searchQuery = ref('');
|
||||||
|
|
||||||
|
// 搜索过滤逻辑
|
||||||
|
const filteredGroups = computed(() => {
|
||||||
|
return props.initialGroups.filter(g =>
|
||||||
|
g.name.toLowerCase().includes(searchQuery.value.toLowerCase())
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleSelect = (group) => {
|
||||||
|
emit('select', group);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 遮罩层 */
|
||||||
|
.modal-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.2);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹出层主容器 */
|
||||||
|
.chat-modal {
|
||||||
|
width: 360px;
|
||||||
|
max-height: 80vh;
|
||||||
|
background: rgba(255, 255, 255, 0.9);
|
||||||
|
backdrop-filter: blur(20px);
|
||||||
|
border-radius: 28px;
|
||||||
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 头部样式 */
|
||||||
|
.modal-header {
|
||||||
|
padding: 20px 20px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-top {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-top h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 20px;
|
||||||
|
color: #1d1d1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-btn {
|
||||||
|
background: #eee;
|
||||||
|
border: none;
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 50%;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 18px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 搜索框 */
|
||||||
|
.search-bar input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 15px;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: none;
|
||||||
|
background: rgba(0, 0, 0, 0.05);
|
||||||
|
outline: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 列表滚动区 */
|
||||||
|
.chat-list {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 18px;
|
||||||
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-item:hover {
|
||||||
|
background: rgba(0, 122, 255, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 头像 */
|
||||||
|
.avatar {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 15px;
|
||||||
|
margin-right: 14px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: white;
|
||||||
|
font-weight: 600;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-info {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-name {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #1d1d1f;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-preview {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #86868b;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-meta {
|
||||||
|
text-align: right;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #86868b;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unread {
|
||||||
|
background: #007AFF;
|
||||||
|
color: white;
|
||||||
|
font-size: 11px;
|
||||||
|
padding: 2px 7px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 列表过渡动画 */
|
||||||
|
.list-enter-active, .list-leave-active {
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
.list-enter-from, .list-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(-10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px 0;
|
||||||
|
color: #86868b;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,399 @@
|
|||||||
|
<template>
|
||||||
|
<transition name="fade">
|
||||||
|
<div v-if="modelValue" class="modal-mask" @click.self="close">
|
||||||
|
<div class="modal-container">
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<div class="header-title">
|
||||||
|
<button v-if="step === 2" class="btn-back-icon" @click="step = 1">←</button>
|
||||||
|
<h2>{{ step === 1 ? '添加好友' : '验证信息' }}</h2>
|
||||||
|
</div>
|
||||||
|
<button class="icon-close" @click="close">×</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="step === 1" class="step-wrapper">
|
||||||
|
<div class="search-box">
|
||||||
|
<input
|
||||||
|
v-model="keyword"
|
||||||
|
type="text"
|
||||||
|
placeholder="输入 ID / 手机号"
|
||||||
|
@keyup.enter="onSearch"
|
||||||
|
/>
|
||||||
|
<button class="search-btn" @click="onSearch" :disabled="loading">
|
||||||
|
<span v-if="!loading">搜索</span>
|
||||||
|
<span v-else class="spinner"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<transition name="fade-slide">
|
||||||
|
<div v-if="userResult" class="user-card">
|
||||||
|
<div class="user-info">
|
||||||
|
<img :src="userResult.avatar || defaultAvatar" class="avatar" />
|
||||||
|
<div class="detail">
|
||||||
|
<span class="name">{{ userResult.nickName }}</span>
|
||||||
|
<span class="id">ID: {{ userResult.username }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="add-action-btn" @click="goToAddForm">添加好友</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="hasSearched && !userResult" class="empty-state">
|
||||||
|
未找到该用户,请检查输入
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="step === 2" class="step-wrapper form-container">
|
||||||
|
<div class="form-item">
|
||||||
|
<label>备注名</label>
|
||||||
|
<input
|
||||||
|
v-model="form.remark"
|
||||||
|
placeholder="为好友起个备注吧"
|
||||||
|
class="form-input"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="form-item">
|
||||||
|
<label>验证信息</label>
|
||||||
|
<textarea
|
||||||
|
v-model="form.description"
|
||||||
|
placeholder="我是..."
|
||||||
|
rows="3"
|
||||||
|
class="form-textarea"
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="btn-submit"
|
||||||
|
@click="submitAdd"
|
||||||
|
:disabled="submitting"
|
||||||
|
>
|
||||||
|
{{ submitting ? '发送中...' : '提交申请' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import { friendService } from '@/services/friend';
|
||||||
|
import { useMessage } from '../messages/useAlert';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean
|
||||||
|
});
|
||||||
|
const emit = defineEmits(['update:modelValue', 'success']);
|
||||||
|
const message = useMessage();
|
||||||
|
|
||||||
|
// 基础状态
|
||||||
|
const step = ref(1);
|
||||||
|
const loading = ref(false);
|
||||||
|
const submitting = ref(false);
|
||||||
|
const hasSearched = ref(false);
|
||||||
|
const defaultAvatar = 'https://api.dicebear.com/7.x/adventurer/svg?seed=Lucky';
|
||||||
|
|
||||||
|
// 数据
|
||||||
|
const keyword = ref('');
|
||||||
|
const userResult = ref(null);
|
||||||
|
const form = reactive({
|
||||||
|
remark: '',
|
||||||
|
description: '你好,想加你为好友'
|
||||||
|
});
|
||||||
|
|
||||||
|
const close = () => {
|
||||||
|
emit('update:modelValue', false);
|
||||||
|
// 延迟重置,避免动画没做完就变白
|
||||||
|
setTimeout(() => {
|
||||||
|
step.value = 1;
|
||||||
|
userResult.value = null;
|
||||||
|
hasSearched.value = false;
|
||||||
|
keyword.value = '';
|
||||||
|
form.remark = '';
|
||||||
|
form.description = '你好,想加你为好友';
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索逻辑
|
||||||
|
const onSearch = async () => {
|
||||||
|
if (!keyword.value.trim()) return;
|
||||||
|
loading.value = true;
|
||||||
|
hasSearched.value = false;
|
||||||
|
try {
|
||||||
|
const res = await friendService.findUser(keyword.value);
|
||||||
|
userResult.value = res.data;
|
||||||
|
if (res.data) {
|
||||||
|
form.remark = res.data.nickName; // 默认备注为昵称
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
hasSearched.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const goToAddForm = () => {
|
||||||
|
step.value = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提交逻辑
|
||||||
|
const submitAdd = async () => {
|
||||||
|
if (submitting.value) return;
|
||||||
|
submitting.value = true;
|
||||||
|
const res = await friendService.requestFriend({
|
||||||
|
toUserId: userResult.value.id, // 根据你后端字段调整
|
||||||
|
remarkName: form.remark,
|
||||||
|
description: form.description
|
||||||
|
});
|
||||||
|
if(res.code == 0){
|
||||||
|
message.success('已发送好友请求');
|
||||||
|
}else{
|
||||||
|
message.error(res.message);
|
||||||
|
}
|
||||||
|
submitting.value = false;
|
||||||
|
close();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 1. 基础布局与遮罩 */
|
||||||
|
.modal-mask {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.2);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-container {
|
||||||
|
background: #ffffff;
|
||||||
|
width: 380px;
|
||||||
|
border-radius: 28px;
|
||||||
|
padding: 28px;
|
||||||
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2. 头部样式 */
|
||||||
|
.modal-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header h2 {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1d1d1f;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-back-icon {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #007aff;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-close {
|
||||||
|
background: #f5f5f7;
|
||||||
|
border: none;
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: #86868b;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-close:hover {
|
||||||
|
background: #e8e8ed;
|
||||||
|
color: #1d1d1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 3. 搜索区域 */
|
||||||
|
.search-box {
|
||||||
|
display: flex;
|
||||||
|
background: #f5f5f7;
|
||||||
|
border-radius: 14px;
|
||||||
|
padding: 6px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
transition: all 0.3s;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-box:focus-within {
|
||||||
|
background: #fff;
|
||||||
|
border-color: #007aff;
|
||||||
|
box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-box input {
|
||||||
|
flex: 1;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
padding: 10px 14px;
|
||||||
|
outline: none;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #1d1d1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-btn {
|
||||||
|
background: #007aff;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 0 18px;
|
||||||
|
border-radius: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-btn:disabled {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4. 用户卡片 */
|
||||||
|
.user-card {
|
||||||
|
background: #f5f5f7;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 72px;
|
||||||
|
height: 72px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 17px;
|
||||||
|
color: #1d1d1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.id {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #86868b;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-action-btn {
|
||||||
|
width: 100%;
|
||||||
|
background: #007aff;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-action-btn:active {
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 5. 表单样式 */
|
||||||
|
.form-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-item label {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #86868b;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input, .form-textarea {
|
||||||
|
width: 100%;
|
||||||
|
background: #f5f5f7;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
font-size: 14px;
|
||||||
|
outline: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input:focus, .form-textarea:focus {
|
||||||
|
background: #fff;
|
||||||
|
border-color: #007aff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-submit {
|
||||||
|
background: #007aff;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 14px;
|
||||||
|
border-radius: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 6. 动画与反馈 */
|
||||||
|
.spinner {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border: 2px solid rgba(255,255,255,0.3);
|
||||||
|
border-top-color: #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: inline-block;
|
||||||
|
animation: spin 0.8s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
to { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-enter-active, .fade-leave-active { transition: opacity 0.3s; }
|
||||||
|
.fade-enter-from, .fade-leave-to { opacity: 0; }
|
||||||
|
|
||||||
|
.fade-slide-enter-active {
|
||||||
|
transition: all 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
|
||||||
|
}
|
||||||
|
.fade-slide-enter-from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
color: #86868b;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 30px 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { useConversationStore } from "@/stores/conversation"
|
||||||
|
|
||||||
|
export const messageHandler = (msg) => {
|
||||||
|
const conversationStore = useConversationStore();
|
||||||
|
const conversation = conversationStore.conversations.find(x => x.targetId == msg.senderId || x.targetId == msg.receiverId);
|
||||||
|
conversation.lastMessage = msg.content;
|
||||||
|
if (conversation.targetId == msg.receiverId) {
|
||||||
|
conversation.unreadCount = 0;
|
||||||
|
} else {
|
||||||
|
conversation.unreadCount += 1;
|
||||||
|
}
|
||||||
|
conversation.dateTime = new Date().toISOString();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,12 +11,22 @@ const routes = [
|
|||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
component: MainView,
|
component: MainView,
|
||||||
|
redirect: '/messages',
|
||||||
|
meta: {
|
||||||
|
requiresAuth: true
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/messages',
|
path: '/messages',
|
||||||
name: 'userMessages',
|
name: 'userMessages',
|
||||||
component: () => import('@/views/messages/MessageList.vue'),
|
component: () => import('@/views/messages/MessageList.vue'),
|
||||||
|
redirect: '/messages/index',
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
path: '/messages/index',
|
||||||
|
name: 'msgDefault',
|
||||||
|
component: () => import('@/views/messages/MessageDefault.vue')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/messages/chat/:id',
|
path: '/messages/chat/:id',
|
||||||
name: '/msgChat',
|
name: '/msgChat',
|
||||||
@@ -25,7 +35,30 @@ const routes = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ path: '/contacts', name: 'userContacts', component: () => import('@/views/contact/ContactList.vue') },
|
{
|
||||||
|
path: '/contacts',
|
||||||
|
name: 'userContacts',
|
||||||
|
redirect: '/contacts/index',
|
||||||
|
component: () => import('@/views/contact/ContactList.vue'),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '/contacts/index',
|
||||||
|
name: "contactDefault",
|
||||||
|
component: () => import('@/views/contact/ContactDefault.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/contacts/info/:id',
|
||||||
|
name: 'contactInfo',
|
||||||
|
component: () => import('@/views/contact/UserInfoContent.vue'),
|
||||||
|
props: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/contacts/requests',
|
||||||
|
name: 'friendRequests',
|
||||||
|
component: () => import('@/views/contact/FriendRequestList.vue')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{ path: '/settings', name: 'userSettings', component: () => import('@/views/settings/SettingMenu.vue') }
|
{ path: '/settings', name: 'userSettings', component: () => import('@/views/settings/SettingMenu.vue') }
|
||||||
],
|
],
|
||||||
meta: {
|
meta: {
|
||||||
@@ -35,6 +68,7 @@ const routes = [
|
|||||||
{
|
{
|
||||||
path: '/index',
|
path: '/index',
|
||||||
component: MainView,
|
component: MainView,
|
||||||
|
redirect: '/messages',
|
||||||
meta: {
|
meta: {
|
||||||
requiresAuth: true
|
requiresAuth: true
|
||||||
}
|
}
|
||||||
@@ -49,10 +83,18 @@ const router = createRouter({
|
|||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
|
if (to.path == '/auth/login') {
|
||||||
|
if (authStore.isLoggedIn) {
|
||||||
|
message.info('已登录,即将跳转...');
|
||||||
|
next('/');
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
}
|
||||||
if (to.meta.requiresAuth && !authStore.isLoggedIn) {
|
if (to.meta.requiresAuth && !authStore.isLoggedIn) {
|
||||||
message.info('未登录,即将跳转...');
|
message.info('未登录,即将跳转...');
|
||||||
next('auth/login');
|
next('auth/login');
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { useMessage } from '@/components/messages/useAlert';
|
import { useMessage } from '@/components/messages/useAlert';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
|
import { useAuthStore } from '@/stores/auth';
|
||||||
|
import { authService } from './auth';
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage();
|
||||||
|
const authStore = useAuthStore();
|
||||||
|
|
||||||
|
let waitqueue = [];
|
||||||
|
let isRefreshing = false;
|
||||||
|
const authURL = ['/auth/login', '/auth/register', '/auth/refresh'];
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000/api', // 从环境变量中读取基础 URL
|
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000/api', // 从环境变量中读取基础 URL
|
||||||
@@ -14,7 +21,7 @@ const api = axios.create({
|
|||||||
|
|
||||||
api.interceptors.request.use(
|
api.interceptors.request.use(
|
||||||
config => {
|
config => {
|
||||||
const token = localStorage.getItem('authToken');
|
const token = authStore.token;
|
||||||
if (token) {
|
if (token) {
|
||||||
config.headers.Authorization = `Bearer ${token}`;
|
config.headers.Authorization = `Bearer ${token}`;
|
||||||
}
|
}
|
||||||
@@ -29,19 +36,61 @@ api.interceptors.response.use(
|
|||||||
response => {
|
response => {
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
err => {
|
async err => {
|
||||||
if (err.response) {
|
const { config, response } = err;
|
||||||
switch (err.response.status) {
|
if (response) {
|
||||||
|
switch (response.status) {
|
||||||
case 401:
|
case 401:
|
||||||
|
if (authURL.some(x => config.url.includes(x))) {
|
||||||
|
authStore.logout();
|
||||||
message.error('未登录,请登录后操作。');
|
message.error('未登录,请登录后操作。');
|
||||||
router.push('/auth/login')
|
router.push('/auth/login')
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
if (config._retry) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
config._retry = true;
|
||||||
|
// 已经在刷新 → 排队
|
||||||
|
if (isRefreshing) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
waitqueue.push(token => {
|
||||||
|
config.headers.Authorization = `Bearer ${token}`
|
||||||
|
resolve(api(config))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
isRefreshing = true;
|
||||||
|
const refreshToken = authStore.refreshToken;
|
||||||
|
if (refreshToken != null && refreshToken != '') {
|
||||||
|
const res = await authService.refresh(refreshToken)
|
||||||
|
authStore.setLoginInfo(res.data.token, res.data.refreshToken, res.data.userInfo)
|
||||||
|
waitqueue.forEach(cb => cb(authStore.token));
|
||||||
|
waitqueue = [];
|
||||||
|
config.headers.Authorization = `Bearer ${authStore.token}`
|
||||||
|
return api(config)
|
||||||
|
}
|
||||||
|
authStore.logout();
|
||||||
|
message.error('未登录,请登录后操作。');
|
||||||
|
router.push('/auth/login')
|
||||||
|
break;
|
||||||
|
case 400:
|
||||||
|
if (response.data && response.data.code == 1003) {
|
||||||
|
message.error(response.data.message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
message.error('请求错误,请检查网络。');
|
message.error('请求错误,请检查网络。');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
|
} else {
|
||||||
|
message.error('请求错误,请检查网络。');
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -13,5 +13,11 @@ export const authService = {
|
|||||||
* @param {*} data
|
* @param {*} data
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
register: (data) => request.post('/auth/register', data)
|
register: (data) => request.post('/auth/register', data),
|
||||||
|
/**
|
||||||
|
* 刷新用户凭证
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
refresh: (refreshToken) => request.post('/auth/refresh', { refreshToken })
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user