Squashed commit of the following:
commit 528cdd51c05d26437f0b23f415e06311b667e9f7 Author: liguoyang <Ligy.97@foxmail.com> Date: Wed Apr 17 15:37:30 2024 +0800 feat 访客预约 commit e73a3fcd9307f86aba2c39578495c03cde1d41f9 Author: liguoyang <Ligy.97@foxmail.com> Date: Tue Apr 16 16:15:16 2024 +0800 feat 业务curd commit b98b6e2764fea875866e11f790f388ccf3c234b5 Merge: a3dcec3 965e84b Author: liguoyang <Ligy.97@foxmail.com> Date: Tue Apr 16 14:56:30 2024 +0800 Merge branch 'feat-visitorAppointments' of https://git.dlhis.com/liguoyang/jinko.yikatong into feat-visitorAppointments commit a3dcec30e1289fbb09de8f85009d3931d971337a Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:57:49 2024 +0800 fix appsettings commit 766fbec0c45a3852a75a7a37686b885ac3b0a77a Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:37:01 2024 +0800 add dockerfile commit 86731d41fee97ba073065ed1b807987760a371a7 Author: liguoyang <Ligy.97@foxmail.com> Date: Sun Apr 14 20:11:56 2024 +0800 fix 测试websocket链接 commit 1301b126a9ba9a7d97cf45967cf2915e1169c505 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:57:49 2024 +0800 fix appsettings commit 081f3a67896c67891c3f80edde82a440b8736851 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:37:01 2024 +0800 add dockerfile commit 271b6c5898b5732a35ccfa0629ce89442ac49143 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:34:26 2024 +0800 test 提交测试代码 commit 965e84b6f3b7f925f8021c9b996cce961b896dea Merge: 578eb6a 6a6fad1 Author: liguoyang <Ligy.97@foxmail.com> Date: Mon Apr 15 17:06:45 2024 +0800 Merge branch 'feat-visitorAppointments' of https://git.dlhis.com/liguoyang/jinko.yikatong into feat-visitorAppointments commit 578eb6afbd96f0bfe4aaf8058fd4743309c74d62 Author: liguoyang <Ligy.97@foxmail.com> Date: Sun Apr 14 20:11:56 2024 +0800 fix 测试websocket链接 commit 114511f1daea64b7dbf9c3c38b73e28b6d0301e6 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:57:49 2024 +0800 fix appsettings commit 5eacfa8af8087eade8553266a12a2cf42305716b Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:37:01 2024 +0800 add dockerfile commit b2ffff1f099be343d89690014d05cb859776acbb Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:34:26 2024 +0800 test 提交测试代码 commit 6a6fad1d1b8772eebf5df12cd74cfd5c955ff560 Author: liguoyang <Ligy.97@foxmail.com> Date: Sun Apr 14 20:11:56 2024 +0800 fix 测试websocket链接 commit 9ce3c4d6f63957c175d65370d9a6b80e10f4254f Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:57:49 2024 +0800 fix appsettings commit c637fd89850cf289d7da457c6c6f47354b5beed3 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:37:01 2024 +0800 add dockerfile commit 58c39815b1c45a99aea0caf503fcb1365c957f03 Author: liguoyang <Ligy.97@foxmail.com> Date: Fri Apr 12 17:34:26 2024 +0800 test 提交测试代码
This commit is contained in:
26
Src/Dlhis.Message/Controllers/AppointmentPushController.cs
Normal file
26
Src/Dlhis.Message/Controllers/AppointmentPushController.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Dlhis.Message.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace Dlhis.Message.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class AppointmentPushController : ControllerBase
|
||||
{
|
||||
private readonly IHubContext<VisitorAppointmentHub, IVisitorAppointmentService> _hubContext;
|
||||
|
||||
public AppointmentPushController(IHubContext<VisitorAppointmentHub, IVisitorAppointmentService> hubContext)
|
||||
{
|
||||
_hubContext = hubContext;
|
||||
}
|
||||
|
||||
[HttpPost("push")]
|
||||
public async Task PushAsync(Dictionary<string, string> values)
|
||||
{
|
||||
await _hubContext.Clients.All.Raise(values);
|
||||
}
|
||||
}
|
||||
16
Src/Dlhis.Message/Dlhis.Message.csproj
Normal file
16
Src/Dlhis.Message/Dlhis.Message.csproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>..\..</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.8.3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
23
Src/Dlhis.Message/Dockerfile
Normal file
23
Src/Dlhis.Message/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["Src/Dlhis.Message/Dlhis.Message.csproj", "Src/Dlhis.Message/"]
|
||||
RUN dotnet restore "./Src/Dlhis.Message/./Dlhis.Message.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/Src/Dlhis.Message"
|
||||
RUN dotnet build "./Dlhis.Message.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./Dlhis.Message.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "Dlhis.Message.dll"]
|
||||
22
Src/Dlhis.Message/Packs/SignalRPack.cs
Normal file
22
Src/Dlhis.Message/Packs/SignalRPack.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
|
||||
namespace Dlhis.Message.Packs;
|
||||
|
||||
public class SignalRPack : BaseAppPack
|
||||
{
|
||||
public override bool IsBeforeUseRouting => false;
|
||||
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddSignalR();
|
||||
}
|
||||
|
||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapHub<VisitorAppointmentHub>("/hub/appointment");
|
||||
});
|
||||
}
|
||||
}
|
||||
20
Src/Dlhis.Message/Program.cs
Normal file
20
Src/Dlhis.Message/Program.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.Startup;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
KurisuHost.Run<Startup>(true, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class Startup : DefaultStartup
|
||||
{
|
||||
public Startup(IConfiguration configuration) : base(configuration)
|
||||
{
|
||||
IdentityModelEventSource.ShowPII = true;
|
||||
}
|
||||
}
|
||||
|
||||
15
Src/Dlhis.Message/Properties/launchSettings.json
Normal file
15
Src/Dlhis.Message/Properties/launchSettings.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Dlhis.Message": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "weatherforecast",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5050"
|
||||
}
|
||||
},
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json"
|
||||
}
|
||||
6
Src/Dlhis.Message/Services/IVisitorAppointmentService.cs
Normal file
6
Src/Dlhis.Message/Services/IVisitorAppointmentService.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Dlhis.Message.Services;
|
||||
|
||||
public interface IVisitorAppointmentService
|
||||
{
|
||||
Task Raise(Dictionary<string, string> obj);
|
||||
}
|
||||
26
Src/Dlhis.Message/TestBackgroundService.cs
Normal file
26
Src/Dlhis.Message/TestBackgroundService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
using Dlhis.Message.Services;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace Dlhis.Message
|
||||
{
|
||||
public class TestBackgroundService : BackgroundService, ISingletonDependency
|
||||
{
|
||||
private readonly IHubContext<VisitorAppointmentHub, IVisitorAppointmentService> _hubContext;
|
||||
|
||||
public TestBackgroundService(IHubContext<VisitorAppointmentHub, IVisitorAppointmentService> hubContext)
|
||||
{
|
||||
_hubContext = hubContext;
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
await _hubContext.Clients.All.Raise(new Dictionary<string, string> { ["name"] = "ligy" });
|
||||
|
||||
await Task.Delay(1000 * 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Src/Dlhis.Message/VisitorAppointmentHub.cs
Normal file
19
Src/Dlhis.Message/VisitorAppointmentHub.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Dlhis.Message.Services;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace Dlhis.Message;
|
||||
|
||||
public class VisitorAppointmentHub : Hub<IVisitorAppointmentService>
|
||||
{
|
||||
private readonly ILogger<VisitorAppointmentHub> _logger;
|
||||
|
||||
public VisitorAppointmentHub(ILogger<VisitorAppointmentHub> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public override async Task OnConnectedAsync()
|
||||
{
|
||||
_logger.LogInformation("链接");
|
||||
}
|
||||
}
|
||||
25
Src/Dlhis.Message/appsettings.Development.json
Normal file
25
Src/Dlhis.Message/appsettings.Development.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"SwaggerOptions": {
|
||||
"Enable": true,
|
||||
"Authority": "https://yikatong.isawesome.cn/oauth2",
|
||||
"ClientId": "4fb184324eac4180",
|
||||
"ClientSecret": "8ac8f235152f1524",
|
||||
"Scopes": {
|
||||
"openid": "openid",
|
||||
"profile": "profile",
|
||||
"yikatong": "yikatong"
|
||||
}
|
||||
},
|
||||
"IdentityServerOptions": {
|
||||
"Authority": "https://yikatong.isawesome.cn/oauth2",
|
||||
"RequireHttpsMetadata": true,
|
||||
"Issuer": "identity.isawesome.cn",
|
||||
"Audience": ""
|
||||
}
|
||||
}
|
||||
72
Src/Dlhis.Message/appsettings.json
Normal file
72
Src/Dlhis.Message/appsettings.json
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"SqlSugarOptions": {
|
||||
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
|
||||
"SlaveConnectionString": [],
|
||||
"Timeout": 30,
|
||||
"SlowSqlTime": 1,
|
||||
"EnableSqlLog": false
|
||||
},
|
||||
"SwaggerOptions": {
|
||||
"Enable": true,
|
||||
"Authority": "http://identity.oauth.svc.cluster.local",
|
||||
"ClientId": "4fb184324eac4180",
|
||||
"ClientSecret": "8ac8f235152f1524",
|
||||
"Scopes": {
|
||||
"openid": "openid",
|
||||
"profile": "profile",
|
||||
"yikatong": "yikatong"
|
||||
}
|
||||
},
|
||||
"IdentityServerOptions": {
|
||||
"Authority": "http://identity.oauth.svc.cluster.local",
|
||||
"RequireHttpsMetadata": false,
|
||||
"Issuer": "identity.isawesome.cn",
|
||||
"Audience": "",
|
||||
"Pat": {
|
||||
"Enable": false,
|
||||
"Scheme": "token",
|
||||
"ClientId": "reference",
|
||||
"ClientSecret": "123456"
|
||||
}
|
||||
},
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"System": "Warning",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "Async",
|
||||
"Args": {
|
||||
"configure": [
|
||||
{
|
||||
"Name": "Console",
|
||||
"Args": {
|
||||
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "MySQL",
|
||||
"Args": {
|
||||
"connectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=logs;charset=utf8mb4;",
|
||||
"tableName": "Logs",
|
||||
"autoCreateSqlTable": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user