From 9ff5630cf51c1d22b9d916286d71114d8a0bf4f1 Mon Sep 17 00:00:00 2001 From: LiuXin Date: Wed, 20 Aug 2025 15:02:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DahAlarm/DahuaGeneralCtlService.cs | 24 +++++----- .../.config/dotnet-tools.json | 13 ++++++ .../Manage.AppHost.AppHost/docker-compose.yml | 32 +++++++++++++ .../Video.API/Properties/launchSettings.json | 45 ++++++++++++------- 4 files changed, 86 insertions(+), 28 deletions(-) create mode 100644 WeiCloud.Fusion/AlarmService/AlarmService.API/.config/dotnet-tools.json create mode 100644 WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/docker-compose.yml diff --git a/WeiCloud.Fusion/AlarmService/Alarm.DomainService/DahAlarm/DahuaGeneralCtlService.cs b/WeiCloud.Fusion/AlarmService/Alarm.DomainService/DahAlarm/DahuaGeneralCtlService.cs index 4b1713c..b22d34c 100644 --- a/WeiCloud.Fusion/AlarmService/Alarm.DomainService/DahAlarm/DahuaGeneralCtlService.cs +++ b/WeiCloud.Fusion/AlarmService/Alarm.DomainService/DahAlarm/DahuaGeneralCtlService.cs @@ -17,8 +17,10 @@ namespace Alarm.DomainService.DahAlarm private readonly MQTTClient _mqttClient; private readonly IMqttClientService _mqttClientService; private readonly ITokenProviderService _tokenProviderService; - private readonly HttpClient _http; + + // private readonly HttpClient _http; private string mqttHostIp; + private int mqttHostPort; private int mqttTimeout; private string mqttUsername; @@ -48,16 +50,16 @@ namespace Alarm.DomainService.DahAlarm topicName = _configuration["SubscribeMQTT:TopicName"]!; _mqttClientService = mqttClientService; _tokenProviderService = tokenProviderService; - _http = http; + // _http = http; } - ///// - ///// 开发测试的时候,忽略证书 - ///// - //private static readonly HttpClient _http = new(new HttpClientHandler - //{ - // ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator, - //}); + /// + /// 开发测试的时候,忽略证书 + /// + private static readonly HttpClient _http = new(new HttpClientHandler + { + ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator, + }); /// /// 新增报警事件订阅 @@ -286,8 +288,8 @@ namespace Alarm.DomainService.DahAlarm _logger.LogWarning("获取事件列表:token无效"); return new DaHApiResult { Success = false, Code = "1009", Msg = "token无效" }; } - // var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/evo-brm/1.0.0/device/1000014"; - var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/evo-event/1.0.0/subscribe/subscribe-list?monitorType=url&category={name}"; + var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/evo-brm/1.0.0/device/1000021"; + //var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/evo-event/1.0.0/subscribe/subscribe-list?monitorType=url&category={name}"; try { diff --git a/WeiCloud.Fusion/AlarmService/AlarmService.API/.config/dotnet-tools.json b/WeiCloud.Fusion/AlarmService/AlarmService.API/.config/dotnet-tools.json new file mode 100644 index 0000000..837b189 --- /dev/null +++ b/WeiCloud.Fusion/AlarmService/AlarmService.API/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "9.0.8", + "commands": [ + "dotnet-ef" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/docker-compose.yml b/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/docker-compose.yml new file mode 100644 index 0000000..3c47d26 --- /dev/null +++ b/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/docker-compose.yml @@ -0,0 +1,32 @@ + +version: "3.9" + +services: + video-api: + image: lxxh1992/video-api:${VIDEO_TAG:-1.1} + container_name: video-api + restart: always + environment: + - ASPNETCORE_ENVIRONMENT=Production + healthcheck: + test: ["CMD", "curl", "-fsS", "http://localhost:8080/healthz"] + interval: 30s + timeout: 3s + retries: 3 + # 仅绑定到本机回环,避免对公网暴露端口 + ports: + - "127.0.0.1:5001:8080" + + alarmservice-api: + image: lxxh1992/alarmservice-api:${ALARM_TAG:-1.1} + container_name: alarmservice-api + restart: always + environment: + - ASPNETCORE_ENVIRONMENT=Production + healthcheck: + test: ["CMD", "curl", "-fsS", "http://localhost:8080/healthz"] + interval: 30s + timeout: 3s + retries: 3 + ports: + - "127.0.0.1:5002:8080" diff --git a/WeiCloud.Fusion/VideoService/Video.API/Properties/launchSettings.json b/WeiCloud.Fusion/VideoService/Video.API/Properties/launchSettings.json index c57bfb9..75c68f3 100644 --- a/WeiCloud.Fusion/VideoService/Video.API/Properties/launchSettings.json +++ b/WeiCloud.Fusion/VideoService/Video.API/Properties/launchSettings.json @@ -1,33 +1,24 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:2357", - "sslPort": 44365 - } - }, +{ "profiles": { "http": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5224", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5224" }, "https": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "https://localhost:7161;http://localhost:5224", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7161;http://localhost:5224" }, "IIS Express": { "commandName": "IISExpress", @@ -36,6 +27,26 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "8081", + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": true + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:2357", + "sslPort": 44365 } } -} +} \ No newline at end of file