wip: web端

main
NoahLan 9 months ago
parent ba1a0e86fd
commit 3c9373654a

@ -29,11 +29,21 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
common.props = common.props
end.sh = end.sh
start.sh = start.sh
using.props = using.props
usings.props = usings.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "module", "module", "{EEAD0AD4-0F90-46D9-A775-D88AE07E2869}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Domain.Shared", "src\NPin.Domain.Shared\NPin.Domain.Shared.csproj", "{9718B82F-B12A-4F4C-A22E-A0C10B49C54D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Domain", "src\NPin.Domain\NPin.Domain.csproj", "{DDB9B331-3CB1-47C1-8AD8-96A3587A774D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Application", "src\NPin.Application\NPin.Application.csproj", "{34CEB35B-97EF-41DB-B10B-DC83B2453E9D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Application.Contracts", "src\NPin.Application.Contracts\NPin.Application.Contracts.csproj", "{C4D324BB-01B6-436F-9AA6-136C7D5438F6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.SqlSugarCore", "src\NPin.SqlSugarCore\NPin.SqlSugarCore.csproj", "{DC8E2E59-589F-4521-95E2-9CE7E1DD5541}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -80,6 +90,26 @@ Global
{CE218FFC-52D5-4C6A-857D-5CAA649A3A2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE218FFC-52D5-4C6A-857D-5CAA649A3A2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE218FFC-52D5-4C6A-857D-5CAA649A3A2E}.Release|Any CPU.Build.0 = Release|Any CPU
{9718B82F-B12A-4F4C-A22E-A0C10B49C54D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9718B82F-B12A-4F4C-A22E-A0C10B49C54D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9718B82F-B12A-4F4C-A22E-A0C10B49C54D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9718B82F-B12A-4F4C-A22E-A0C10B49C54D}.Release|Any CPU.Build.0 = Release|Any CPU
{DDB9B331-3CB1-47C1-8AD8-96A3587A774D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DDB9B331-3CB1-47C1-8AD8-96A3587A774D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DDB9B331-3CB1-47C1-8AD8-96A3587A774D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DDB9B331-3CB1-47C1-8AD8-96A3587A774D}.Release|Any CPU.Build.0 = Release|Any CPU
{34CEB35B-97EF-41DB-B10B-DC83B2453E9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34CEB35B-97EF-41DB-B10B-DC83B2453E9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34CEB35B-97EF-41DB-B10B-DC83B2453E9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34CEB35B-97EF-41DB-B10B-DC83B2453E9D}.Release|Any CPU.Build.0 = Release|Any CPU
{C4D324BB-01B6-436F-9AA6-136C7D5438F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4D324BB-01B6-436F-9AA6-136C7D5438F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4D324BB-01B6-436F-9AA6-136C7D5438F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4D324BB-01B6-436F-9AA6-136C7D5438F6}.Release|Any CPU.Build.0 = Release|Any CPU
{DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{088B4948-AE5B-45B3-A9FA-B853671CFA05} = {F2A0A89E-A2F9-48CF-AD38-0318B5ACD11C}
@ -92,5 +122,10 @@ Global
{4C59B5B2-C140-48A7-ABFB-7581905BFDE4} = {F2A0A89E-A2F9-48CF-AD38-0318B5ACD11C}
{BFDBFC7F-58D3-4816-AFA8-93265E28268C} = {F2A0A89E-A2F9-48CF-AD38-0318B5ACD11C}
{CE218FFC-52D5-4C6A-857D-5CAA649A3A2E} = {F2A0A89E-A2F9-48CF-AD38-0318B5ACD11C}
{9718B82F-B12A-4F4C-A22E-A0C10B49C54D} = {86F61EBB-4ACC-459C-AB3C-C8D486C3017D}
{DDB9B331-3CB1-47C1-8AD8-96A3587A774D} = {86F61EBB-4ACC-459C-AB3C-C8D486C3017D}
{34CEB35B-97EF-41DB-B10B-DC83B2453E9D} = {86F61EBB-4ACC-459C-AB3C-C8D486C3017D}
{C4D324BB-01B6-436F-9AA6-136C7D5438F6} = {86F61EBB-4ACC-459C-AB3C-C8D486C3017D}
{DC8E2E59-589F-4521-95E2-9CE7E1DD5541} = {86F61EBB-4ACC-459C-AB3C-C8D486C3017D}
EndGlobalSection
EndGlobal

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<ItemGroup>
<Folder Include="Dtos\" />
<Folder Include="IServices\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\framework\NPin.Framework.Ddd.Application.Contracts\NPin.Framework.Ddd.Application.Contracts.csproj" />
<ProjectReference Include="..\NPin.Domain.Shared\NPin.Domain.Shared.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,15 @@
using NPin.Domain.Shared;
using NPin.Framework.Ddd.Application.Contracts;
namespace NPin.Application.Contracts;
[DependsOn(
typeof(NPinDomainSharedModule),
// TODO RBAC
// TODO Bbs
// TODO Tenant
typeof(NPinFrameworkDddApplicationContractsModule))]
public class NPinApplicationContractsModule : AbpModule
{
}

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<ItemGroup>
<ProjectReference Include="..\..\Framework\NPin.Framework.Ddd.Application\NPin.Framework.Ddd.Application.csproj" />
<ProjectReference Include="..\NPin.Application.Contracts\NPin.Application.Contracts.csproj" />
<ProjectReference Include="..\NPin.Domain\NPin.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Jobs\" />
<Folder Include="Services\" />
</ItemGroup>
</Project>

@ -0,0 +1,9 @@
using NPin.Application.Contracts;
using NPin.Framework.Ddd.Application.Contracts;
namespace NPin.Application;
public class NPinApplicationModule: AbpModule
{
}

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<ItemGroup>
<Folder Include="Consts\" />
<Folder Include="Dtos\" />
<Folder Include="Enums\" />
<Folder Include="Etos\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Users.Domain.Shared" Version="8.0.4" />
</ItemGroup>
</Project>

@ -0,0 +1,11 @@
namespace NPin.Domain.Shared;
[DependsOn(
typeof(NPinDomainSharedModule))
// TODO RBAC
// TODO BBS
// TODO AuditLogging
]
public class NPinDomainSharedModule : AbpModule
{
}

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<ItemGroup>
<Folder Include="EventHandlers\" />
<Folder Include="Entities\" />
<Folder Include="Managers\" />
<Folder Include="Repositories\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\framework\NPin.Framework.Mapster\NPin.Framework.Mapster.csproj" />
<ProjectReference Include="..\..\framework\NPin.Framework.SqlSugarCore.Abstractions\NPin.Framework.SqlSugarCore.Abstractions.csproj" />
<ProjectReference Include="..\NPin.Domain.Shared\NPin.Domain.Shared.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<ItemGroup>
<Folder Include="DataSeeds\" />
<Folder Include="Repositories\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\framework\NPin.Framework.Mapster\NPin.Framework.Mapster.csproj" />
<ProjectReference Include="..\..\framework\NPin.Framework.SqlSugarCore\NPin.Framework.SqlSugarCore.csproj" />
<ProjectReference Include="..\NPin.Domain\NPin.Domain.csproj" />
</ItemGroup>
</Project>

@ -1,20 +1,47 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
#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:8.0 AS base
USER app
WORKDIR /app
EXPOSE 80
EXPOSE 443
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["NPin/NPin.csproj", "NPin/"]
RUN dotnet restore "NPin/NPin.csproj"
COPY ["src/NPin.Web/NPin.Web.csproj", "src/NPin.Web/"]
COPY ["framework/NPin.Framework.AspNetCore.Authentication.OAuth/NPin.Framework.AspNetCore.Authentication.OAuth.csproj", "framework/NPin.Framework.AspNetCore.Authentication.OAuth/"]
COPY ["framework/NPin.Framework.AspNetCore/NPin.Framework.AspNetCore.csproj", "framework/NPin.Framework.AspNetCore/"]
COPY ["framework/NPin.Framework.Core/NPin.Framework.Core.csproj", "framework/NPin.Framework.Core/"]
COPY ["src/NPin.Application/NPin.Application.csproj", "src/NPin.Application/"]
COPY ["framework/NPin.Framework.Ddd.Application/NPin.Framework.Ddd.Application.csproj", "framework/NPin.Framework.Ddd.Application/"]
COPY ["framework/NPin.Framework.Ddd.Application.Contracts/NPin.Framework.Ddd.Application.Contracts.csproj", "framework/NPin.Framework.Ddd.Application.Contracts/"]
COPY ["module/bbs/NPin.Framework.Bbs.Application/NPin.Framework.Bbs.Application.csproj", "module/bbs/NPin.Framework.Bbs.Application/"]
COPY ["module/rbac/NPin.Framework.Rbac.Application/NPin.Framework.Rbac.Application.csproj", "module/rbac/NPin.Framework.Rbac.Application/"]
COPY ["module/rbac/NPin.Framework.Rbac.Application.Contracts/NPin.Framework.Rbac.Application.Contracts.csproj", "module/rbac/NPin.Framework.Rbac.Application.Contracts/"]
COPY ["module/rbac/NPin.Framework.Rbac.Domain.Shared/NPin.Framework.Rbac.Domain.Shared.csproj", "module/rbac/NPin.Framework.Rbac.Domain.Shared/"]
COPY ["framework/NPin.Framework.Mapster/NPin.Framework.Mapster.csproj", "framework/NPin.Framework.Mapster/"]
COPY ["framework/NPin.Framework.SqlSugarCore.Abstractions/NPin.Framework.SqlSugarCore.Abstractions.csproj", "framework/NPin.Framework.SqlSugarCore.Abstractions/"]
COPY ["module/rbac/NPin.Framework.Rbac.Domain/NPin.Framework.Rbac.Domain.csproj", "module/rbac/NPin.Framework.Rbac.Domain/"]
COPY ["module/bbs/NPin.Framework.Bbs.Application.Contracts/NPin.Framework.Bbs.Application.Contracts.csproj", "module/bbs/NPin.Framework.Bbs.Application.Contracts/"]
COPY ["module/bbs/NPin.Framework.Bbs.Domain.Shared/NPin.Framework.Bbs.Domain.Shared.csproj", "module/bbs/NPin.Framework.Bbs.Domain.Shared/"]
COPY ["module/bbs/NPin.Framework.Bbs.Domain/NPin.Framework.Bbs.Domain.csproj", "module/bbs/NPin.Framework.Bbs.Domain/"]
COPY ["src/NPin.Application.Contracts/NPin.Application.Contracts.csproj", "src/NPin.Application.Contracts/"]
COPY ["src/NPin.Domain.Shared/NPin.Domain.Shared.csproj", "src/NPin.Domain.Shared/"]
COPY ["src/NPin.Domain/NPin.Domain.csproj", "src/NPin.Domain/"]
COPY ["src/NPin.SqlSugarCore/NPin.SqlSugarCore.csproj", "src/NPin.SqlSugarCore/"]
COPY ["framework/NPin.Framework.SqlSugarCore/NPin.Framework.SqlSugarCore.csproj", "framework/NPin.Framework.SqlSugarCore/"]
COPY ["module/bbs/NPin.Framework.Bbs.SqlSugarCore/NPin.Framework.Bbs.SqlSugarCore.csproj", "module/bbs/NPin.Framework.Bbs.SqlSugarCore/"]
COPY ["module/rbac/NPin.Framework.Rbac.SqlSugarCore/NPin.Framework.Rbac.SqlSugarCore.csproj", "module/rbac/NPin.Framework.Rbac.SqlSugarCore/"]
RUN dotnet restore "./src/NPin.Web/./NPin.Web.csproj"
COPY . .
WORKDIR "/src/NPin"
RUN dotnet build "NPin.csproj" -c Release -o /app/build
WORKDIR "/src/src/NPin.Web"
RUN dotnet build "./NPin.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
RUN dotnet publish "NPin.csproj" -c Release -o /app/publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./NPin.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "NPin.dll"]
ENTRYPOINT ["dotnet", "NPin.Web.dll"]

@ -1,17 +1,45 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<RootNamespace>NPin</RootNamespace>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<Import Project="..\..\common.props"/>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.2"/>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1"/>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1"/>
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0"/>
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.0.3"/>
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="8.0.3"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="8.0.3"/>
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.0.3"/>
<PackageReference Include="Volo.Abp.Autofac" Version="8.0.3"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Framework\NPin.Framework.AspNetCore.Authentication.OAuth\NPin.Framework.AspNetCore.Authentication.OAuth.csproj"/>
<ProjectReference Include="..\..\Framework\NPin.Framework.AspNetCore\NPin.Framework.AspNetCore.csproj"/>
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\icon\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\icon\"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<None Update="ip2region.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

@ -0,0 +1,10 @@
using Volo.Abp.Modularity;
namespace NPin;
// [DependsOn(
// typeof(NPin))]
public class NPinWebModule: AbpModule
{
}

@ -1,44 +1,42 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
using NPin;
using Serilog;
using Serilog.Events;
// 创建日志
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.AspNetCore.Hosting.Diagnostics", LogEventLevel.Error)
.MinimumLevel.Override("Quartz", LogEventLevel.Warning)
// 可使用{SourceContext}记录
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("logs/log-.txt", rollingInterval: RollingInterval.Day,
restrictedToMinimumLevel: LogEventLevel.Debug))
.WriteTo.Async(c => c.File("logs/error-.txt", rollingInterval: RollingInterval.Day,
restrictedToMinimumLevel: LogEventLevel.Error))
.WriteTo.Async(c => c.Console())
.CreateLogger();
try
{
app.UseSwagger();
app.UseSwaggerUI();
}
Log.Information("NPin-Framework (Abp.vNext) 启动!");
app.UseHttpsRedirection();
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseUrls(builder.Configuration["App:SelfUrl"]);
builder.Host.UseAutofac();
builder.Host.UseSerilog();
var summaries = new[]
await builder.Services.AddApplicationAsync<NPinWebModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
}
catch (Exception ex)
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
app.MapGet("/weatherforecast", () =>
{
var forecast = Enumerable.Range(1, 5).Select(index =>
new WeatherForecast
(
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
Random.Shared.Next(-20, 55),
summaries[Random.Shared.Next(summaries.Length)]
))
.ToArray();
return forecast;
})
.WithName("GetWeatherForecast")
.WithOpenApi();
app.Run();
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
Log.Fatal(ex, "NPin-Framework (Abp.vNext) 爆炸!");
}
finally
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
Log.CloseAndFlush();
}

@ -1,9 +1,24 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
// "Default": "Information",
"Default": "Debug",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"App": {
"SelfUrl": "http://*:19001",
"CorsOrigins": "http://localhost:19001;http://localhost:18000"
},
"DbList": [
"Sqlite",
"Mysql",
"Sqlserver",
"Oracle",
"Postgresql"
],
"DbConnOptions": {
}
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Loading…
Cancel
Save