增加报警服务

pull/3/head
刘鑫 3 months ago
parent 5fa957470b
commit 89b151de04
  1. 9
      WeiCloud.Fusion/Alarm.DomainService/Alarm.DomainService.csproj
  2. 6
      WeiCloud.Fusion/Alarm.DomainService/Class1.cs
  3. 9
      WeiCloud.Fusion/AlarmService/AlarmService.API/AlarmService.API.csproj
  4. 6
      WeiCloud.Fusion/AlarmService/AlarmService.API/AlarmService.API.http
  5. 33
      WeiCloud.Fusion/AlarmService/AlarmService.API/Controllers/WeatherForecastController.cs
  6. 27
      WeiCloud.Fusion/AlarmService/AlarmService.API/Program.cs
  7. 41
      WeiCloud.Fusion/AlarmService/AlarmService.API/Properties/launchSettings.json
  8. 13
      WeiCloud.Fusion/AlarmService/AlarmService.API/WeatherForecast.cs
  9. 9
      WeiCloud.Fusion/AlarmService/AlarmService.API/appsettings.json
  10. 16
      WeiCloud.Fusion/WeiCloud.Fusion.sln

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,6 @@
namespace Alarm.DomainService
{
public class Class1
{
}
}

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

@ -0,0 +1,6 @@
@AlarmService.API_HostAddress = http://localhost:5283
GET {{AlarmService.API_HostAddress}}/weatherforecast/
Accept: application/json
###

@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;
namespace AlarmService.API.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}

@ -0,0 +1,27 @@
namespace AlarmService.API
{
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
}
}
}

@ -0,0 +1,41 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:49511",
"sslPort": 44376
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "weatherforecast",
"applicationUrl": "http://localhost:5283",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "weatherforecast",
"applicationUrl": "https://localhost:7230;http://localhost:5283",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

@ -0,0 +1,13 @@
namespace AlarmService.API
{
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}
}

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

@ -43,6 +43,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeiCloud.Core", "WeiCloud.C
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Video.Application", "VideoService\Video.Application\Video.Application.csproj", "{9F2BD2C5-6496-419D-B87A-4F481E963C4D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AlarmService", "AlarmService", "{18791734-CA81-482D-964A-CA6D0F308B8E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlarmService.API", "AlarmService\AlarmService.API\AlarmService.API.csproj", "{2677EAF0-9F7F-4969-B8B1-3006F35EB93E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Alarm.DomainService", "Alarm.DomainService\Alarm.DomainService.csproj", "{3ED553C4-3A63-4613-B979-472FDA5EA346}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -105,6 +111,14 @@ Global
{9F2BD2C5-6496-419D-B87A-4F481E963C4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F2BD2C5-6496-419D-B87A-4F481E963C4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F2BD2C5-6496-419D-B87A-4F481E963C4D}.Release|Any CPU.Build.0 = Release|Any CPU
{2677EAF0-9F7F-4969-B8B1-3006F35EB93E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2677EAF0-9F7F-4969-B8B1-3006F35EB93E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2677EAF0-9F7F-4969-B8B1-3006F35EB93E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2677EAF0-9F7F-4969-B8B1-3006F35EB93E}.Release|Any CPU.Build.0 = Release|Any CPU
{3ED553C4-3A63-4613-B979-472FDA5EA346}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3ED553C4-3A63-4613-B979-472FDA5EA346}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3ED553C4-3A63-4613-B979-472FDA5EA346}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3ED553C4-3A63-4613-B979-472FDA5EA346}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -124,6 +138,8 @@ Global
{D97C471C-3190-4F8E-A916-7A056A65EDCE} = {0A3134C8-219C-4674-B152-1FA6561E4217}
{40B0D902-553C-C52F-71A2-56FB176FCCBD} = {44DAA396-C724-480A-A2BC-9A33D29E8FEA}
{9F2BD2C5-6496-419D-B87A-4F481E963C4D} = {19A25984-FFA8-49BE-A710-6F269A406C61}
{2677EAF0-9F7F-4969-B8B1-3006F35EB93E} = {18791734-CA81-482D-964A-CA6D0F308B8E}
{3ED553C4-3A63-4613-B979-472FDA5EA346} = {18791734-CA81-482D-964A-CA6D0F308B8E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {379A56DA-D3F0-4E7E-8FF7-DA8E20015BF3}

Loading…
Cancel
Save