Compare commits
93 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d9e7658d7 | |||
| d340be4e2c | |||
| 4afd7924b7 | |||
| 30e5e6a4dc | |||
| df78f842f3 | |||
| 5138daebea | |||
| bbead3a651 | |||
| 802624e7ea | |||
| b2bccc34f5 | |||
| f060641e97 | |||
| e7aaacc410 | |||
| 75cd096b60 | |||
| e4629b1771 | |||
| b699762c1b | |||
| 931ecbd4bc | |||
| 79171b51b2 | |||
| 29201fa84e | |||
| 7171ac44ac | |||
| 1b82fc3545 | |||
| e3b058a4e8 | |||
| 42a4f1e2c4 | |||
| 60c4958adf | |||
| 2e61ed8f92 | |||
| b0b95d54fe | |||
| efce7162c4 | |||
| 4eac47edfa | |||
| eb8e9c3a8a | |||
| 6dd678ec31 | |||
| ab1ffad658 | |||
| b8a25b3b52 | |||
| fdfabd725b | |||
| 8d479feaee | |||
| c5e9ab2e5a | |||
| f0d1e719ac | |||
| f832949999 | |||
| b2af429f25 | |||
| de6c5f044a | |||
| 578967e3e8 | |||
| 5a8ecd01d6 | |||
| 00aef89ed7 | |||
| e783b23baa | |||
| a8413057e4 | |||
| a234d3255e | |||
| 08b37ba79f | |||
| 04e324e900 | |||
| 283c30310a | |||
| ab8f120366 | |||
| a695a21bcb | |||
| 0f55e2e108 | |||
| 3776a011ed | |||
| 2360504491 | |||
| e79925f402 | |||
| 6573602530 | |||
| 9028667b7a | |||
| d0d09fc875 | |||
| e15afa8e3d | |||
| b05264153c | |||
| 136ad489b4 | |||
| 15cef7a060 | |||
| edc75c67fb | |||
| 423900e092 | |||
| d70bb9f596 | |||
| 365acca3ab | |||
| 1aa2f5f0cf | |||
| 46c0c446fd | |||
| b948719917 | |||
| 89590b1088 | |||
| 7b3499d692 | |||
| 0eb4e5ca77 | |||
| bb59bbb7cf | |||
| 151384da99 | |||
| 72701be91d | |||
| 281d300292 | |||
| 6a4aa91e01 | |||
| 28954870f6 | |||
| 89c8236f99 | |||
| 69d2b460b6 | |||
| 1f5bc3e971 | |||
| f1c609b4be | |||
| 1419e37ed5 | |||
| 4e465563c4 | |||
| 8bb4f18be3 | |||
| 2709816ccd | |||
| ea0d6d21f0 | |||
| 36759da784 | |||
| 26db968945 | |||
| dbde1486e2 | |||
| b545a603b0 | |||
| ff0ec31ed0 | |||
| 6f2a1d1990 | |||
| a1038f1b7b | |||
| c667df1ce3 | |||
| 886cec11fb |
3
.gitignore
vendored
3
.gitignore
vendored
@ -263,3 +263,6 @@ src/KonSoft.Admin.Blazor.Server.Tiered/Logs/*
|
||||
|
||||
# Use abp install-libs to restore.
|
||||
**/wwwroot/libs/*
|
||||
|
||||
**/Logs/*
|
||||
**/logs.txt
|
||||
60
KonSoft.sln
60
KonSoft.sln
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36414.22 d17.14
|
||||
VisualStudioVersion = 17.14.36414.22
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "applications", "applications", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
|
||||
EndProject
|
||||
@ -49,8 +49,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E67FA5C3-132
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{1C06151A-45F0-4D48-8303-3D4CBE9517F7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared", "shared\KonSoft.Shared\KonSoft.Shared.csproj", "{345B5CDA-DC77-4956-BF96-80707EC1B5B2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Admin.Application", "modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj", "{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Admin.Application.Contracts", "modules\admin\src\KonSoft.Admin.Application.Contracts\KonSoft.Admin.Application.Contracts.csproj", "{9F68B0E2-0B1D-E0E8-1BE7-079F693A4643}"
|
||||
@ -185,6 +183,27 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Report.HttpApi.Host
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.TenantManagement.HttpApi.Host", "microservices\KonSoft.TenantManagement.HttpApi.Host\KonSoft.TenantManagement.HttpApi.Host.csproj", "{3641CA05-99C5-2245-C663-6CE00730E87C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Localization", "shared\KonSoft.Shared.Localization\KonSoft.Shared.Localization.csproj", "{A773C53C-F145-043A-7F55-79ABDB11893B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Hosting", "shared\KonSoft.Shared.Hosting\KonSoft.Shared.Hosting.csproj", "{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Hosting.AspNetCore", "shared\KonSoft.Shared.Hosting.AspNetCore\KonSoft.Shared.Hosting.AspNetCore.csproj", "{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Hosting.Gateways", "shared\KonSoft.Shared.Hosting.Gateways\KonSoft.Shared.Hosting.Gateways.csproj", "{BBB1A129-9ED7-4F08-B710-B6C287197BFB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Hosting.Microservices", "shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj", "{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.DbMigrator", "shared\KonSoft.Shared.DbMigrator\KonSoft.Shared.DbMigrator.csproj", "{AFCC65BC-8477-819B-2575-674AC9D2FDDD}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution items", "Solution items", "{72B7AEA8-8968-469E-AFFC-170E572D640F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.gitignore = .gitignore
|
||||
adminservice.Jenkinsfile = adminservice.Jenkinsfile
|
||||
authserver.Jenkinsfile = authserver.Jenkinsfile
|
||||
docker-compose.yml = docker-compose.yml
|
||||
internalgateway.Jenkinsfile = internalgateway.Jenkinsfile
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -203,10 +222,6 @@ Global
|
||||
{AEBC7053-743F-4F80-BD10-8ED6A8A7B3EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AEBC7053-743F-4F80-BD10-8ED6A8A7B3EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AEBC7053-743F-4F80-BD10-8ED6A8A7B3EE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{345B5CDA-DC77-4956-BF96-80707EC1B5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{345B5CDA-DC77-4956-BF96-80707EC1B5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{345B5CDA-DC77-4956-BF96-80707EC1B5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{345B5CDA-DC77-4956-BF96-80707EC1B5B2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@ -475,6 +490,30 @@ Global
|
||||
{3641CA05-99C5-2245-C663-6CE00730E87C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3641CA05-99C5-2245-C663-6CE00730E87C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3641CA05-99C5-2245-C663-6CE00730E87C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A773C53C-F145-043A-7F55-79ABDB11893B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A773C53C-F145-043A-7F55-79ABDB11893B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A773C53C-F145-043A-7F55-79ABDB11893B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A773C53C-F145-043A-7F55-79ABDB11893B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BBB1A129-9ED7-4F08-B710-B6C287197BFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BBB1A129-9ED7-4F08-B710-B6C287197BFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BBB1A129-9ED7-4F08-B710-B6C287197BFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BBB1A129-9ED7-4F08-B710-B6C287197BFB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AFCC65BC-8477-819B-2575-674AC9D2FDDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AFCC65BC-8477-819B-2575-674AC9D2FDDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AFCC65BC-8477-819B-2575-674AC9D2FDDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AFCC65BC-8477-819B-2575-674AC9D2FDDD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -498,7 +537,6 @@ Global
|
||||
{6C762F40-30BB-4CDA-951B-01D45F7C2B53} = {AAF02051-771B-4CC0-BD17-1A3643F83E09}
|
||||
{E67FA5C3-132C-4F47-B6A6-8FA4376C70BB} = {CF59695F-7948-4743-A467-42E4B4C9EECA}
|
||||
{1C06151A-45F0-4D48-8303-3D4CBE9517F7} = {CF59695F-7948-4743-A467-42E4B4C9EECA}
|
||||
{345B5CDA-DC77-4956-BF96-80707EC1B5B2} = {7EFFD2C6-2041-4967-A715-0F817D70C433}
|
||||
{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9} = {EBCB740D-07E7-4CED-A422-90EB824B9021}
|
||||
{9F68B0E2-0B1D-E0E8-1BE7-079F693A4643} = {EBCB740D-07E7-4CED-A422-90EB824B9021}
|
||||
{D1A86C77-533D-5B68-04F1-7F7BFBF56AC7} = {EBCB740D-07E7-4CED-A422-90EB824B9021}
|
||||
@ -566,6 +604,12 @@ Global
|
||||
{9A034977-0FBC-A3C8-8432-9FDD073F215A} = {4CBFE8AF-968B-453D-B763-3D0437C0883D}
|
||||
{1C89424B-DA16-8840-4AB0-C446CFBD634C} = {4CBFE8AF-968B-453D-B763-3D0437C0883D}
|
||||
{3641CA05-99C5-2245-C663-6CE00730E87C} = {4CBFE8AF-968B-453D-B763-3D0437C0883D}
|
||||
{A773C53C-F145-043A-7F55-79ABDB11893B} = {7EFFD2C6-2041-4967-A715-0F817D70C433}
|
||||
{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF} = {7EFFD2C6-2041-4967-A715-0F817D70C433}
|
||||
{8CA6B487-3AAF-4E77-ACE0-01D878DE4836} = {7EFFD2C6-2041-4967-A715-0F817D70C433}
|
||||
{BBB1A129-9ED7-4F08-B710-B6C287197BFB} = {7EFFD2C6-2041-4967-A715-0F817D70C433}
|
||||
{ADF28580-F8A0-4495-96D6-736C6C7CF3FF} = {7EFFD2C6-2041-4967-A715-0F817D70C433}
|
||||
{AFCC65BC-8477-819B-2575-674AC9D2FDDD} = {7EFFD2C6-2041-4967-A715-0F817D70C433}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}
|
||||
|
||||
@ -20,4 +20,6 @@
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Consts/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Iddict/@EntryIndexedValue">True</s:Boolean>
|
||||
</wpf:ResourceDictionary>
|
||||
27
adminservice.Jenkinsfile
Normal file
27
adminservice.Jenkinsfile
Normal file
@ -0,0 +1,27 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
sh '/usr/libexec/docker/cli-plugins/docker-compose -f ./docker-compose.yml up --build -d adminservice'
|
||||
} catch (Exception e) {
|
||||
error "部署失败: ${e.message}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Health Check') {
|
||||
steps {
|
||||
script {
|
||||
sleep time: 30, unit: 'SECONDS'
|
||||
sh 'docker ps | grep adminservice'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,22 +2,53 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
ARG NODE_VERSION=16.13.0
|
||||
ARG YARN_VERSION=1.22.15
|
||||
RUN echo "deb https://mirrors.huaweicloud.com/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list && \
|
||||
echo "deb https://mirrors.huaweicloud.com/debian/ bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
|
||||
echo "deb https://mirrors.huaweicloud.com/debian/ bookworm-backports main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
|
||||
echo "deb https://mirrors.huaweicloud.com/debian-security bookworm-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
|
||||
apt-get update -yq && \
|
||||
apt-get install -yq curl gnupg && \
|
||||
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
|
||||
apt-get install -yq nodejs && \
|
||||
npm install -g yarn@${YARN_VERSION} && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["NuGet.Config", "."]
|
||||
COPY ["applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj", "applications/KonSoft.AuthServer/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.Application/KonSoft.Admin.Application.csproj", "modules/admin/src/KonSoft.Admin.Application/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.Domain/KonSoft.Admin.Domain.csproj", "modules/admin/src/KonSoft.Admin.Domain/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.Domain.Shared/KonSoft.Admin.Domain.Shared.csproj", "modules/admin/src/KonSoft.Admin.Domain.Shared/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.Application.Contracts/KonSoft.Admin.Application.Contracts.csproj", "modules/admin/src/KonSoft.Admin.Application.Contracts/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.EntityFrameworkCore/KonSoft.Admin.EntityFrameworkCore.csproj", "modules/admin/src/KonSoft.Admin.EntityFrameworkCore/"]
|
||||
COPY ["shared/KonSoft.Shared.Hosting.Microservices/KonSoft.Shared.Hosting.Microservices.csproj", "shared/KonSoft.Shared.Hosting.Microservices/"]
|
||||
COPY ["shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj", "shared/KonSoft.Shared.Hosting.AspNetCore/"]
|
||||
COPY ["shared/KonSoft.Shared.Hosting/KonSoft.Shared.Hosting.csproj", "shared/KonSoft.Shared.Hosting/"]
|
||||
COPY ["shared/KonSoft.Shared.Localization/KonSoft.Shared.Localization.csproj", "shared/KonSoft.Shared.Localization/"]
|
||||
RUN dotnet restore "./applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/applications/KonSoft.AuthServer"
|
||||
RUN dotnet nuget locals all --clear
|
||||
RUN dotnet nuget add source https://mirrors.huaweicloud.com/repository/nuget/v3/index.json -n HuaweiCloud
|
||||
RUN dotnet tool install -g Volo.Abp.Cli --version 8.3.4
|
||||
ENV PATH="$PATH:/root/.dotnet/tools"
|
||||
RUN yarn config set registry https://registry.npmmirror.com
|
||||
RUN yarn cache clean
|
||||
RUN abp install-libs
|
||||
RUN dotnet build "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
# 此阶段用于发布要复制到最终阶段的服务项目
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
# 此阶段在生产中使用,或在常规模式下从 VS 运行时使用(在不使用调试配置时为默认值)
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
@ -39,22 +39,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.4" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="8.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.DistributedLocking" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Account.Web.OpenIddict" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Account.Application" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Account.HttpApi" Version="8.3.4" />
|
||||
@ -69,4 +58,10 @@
|
||||
<PackageReference Include="Volo.Abp.OpenIddict.EntityFrameworkCore" Version="8.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj" />
|
||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.EntityFrameworkCore\KonSoft.Admin.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
using KonSoft.Admin;
|
||||
using KonSoft.Admin.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using KonSoft.Shared.Localization.Localization;
|
||||
using Localization.Resources.AbpUi;
|
||||
using Medallion.Threading;
|
||||
using Medallion.Threading.Redis;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Account;
|
||||
using Volo.Abp.Account.Localization;
|
||||
@ -18,32 +20,25 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
|
||||
using Volo.Abp.AspNetCore.Serilog;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Autofac;
|
||||
using Volo.Abp.BackgroundJobs;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.Caching.StackExchangeRedis;
|
||||
using Volo.Abp.DistributedLocking;
|
||||
using Volo.Abp.Localization;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.OpenIddict;
|
||||
using Volo.Abp.Security.Claims;
|
||||
using Volo.Abp.UI.Navigation.Urls;
|
||||
using Volo.Abp.VirtualFileSystem;
|
||||
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
|
||||
|
||||
namespace KonSoft;
|
||||
|
||||
[DependsOn(
|
||||
typeof(AbpAutofacModule),
|
||||
typeof(AbpCachingStackExchangeRedisModule),
|
||||
typeof(AbpDistributedLockingModule),
|
||||
typeof(AbpAccountWebOpenIddictModule),
|
||||
typeof(AbpAccountApplicationModule),
|
||||
typeof(AbpAccountHttpApiModule),
|
||||
typeof(AbpAccountHttpApiModule),
|
||||
typeof(AdminApplicationModule),
|
||||
typeof(AdminEntityFrameworkCoreModule),
|
||||
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
|
||||
typeof(AbpAspNetCoreSerilogModule)
|
||||
)]
|
||||
typeof(KonSoftSharedHostingMicroservicesModule)
|
||||
)]
|
||||
public class KonSoftAuthServerModule : AbpModule
|
||||
{
|
||||
public override void PreConfigureServices(ServiceConfigurationContext context)
|
||||
@ -61,6 +56,13 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
});
|
||||
});
|
||||
|
||||
context.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||
});
|
||||
|
||||
if (!hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
PreConfigure<AbpOpenIddictAspNetCoreOptions>(options =>
|
||||
@ -70,7 +72,8 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
|
||||
PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
|
||||
{
|
||||
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "59464dba-b66e-48cd-8b81-2e4a9c08c977");
|
||||
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx",
|
||||
"59464dba-b66e-48cd-8b81-2e4a9c08c977");
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -94,46 +97,21 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
{
|
||||
options.StyleBundles.Configure(
|
||||
BasicThemeBundles.Styles.Global,
|
||||
bundle =>
|
||||
{
|
||||
bundle.AddFiles("/global-styles.css");
|
||||
}
|
||||
bundle => { bundle.AddFiles("/global-styles.css"); }
|
||||
);
|
||||
});
|
||||
|
||||
Configure<AbpAuditingOptions>(options =>
|
||||
{
|
||||
options.IsEnabledForGetRequests = true;
|
||||
options.ApplicationName = "AuthServer";
|
||||
options.IsEnabledForGetRequests = true;
|
||||
options.ApplicationName = "AuthServer";
|
||||
});
|
||||
|
||||
Configure<AppUrlOptions>(options =>
|
||||
{
|
||||
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
|
||||
options.RedirectAllowedUrls.AddRange(configuration["App:RedirectAllowedUrls"]?.Split(',') ?? []);
|
||||
});
|
||||
Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; });
|
||||
|
||||
Configure<AbpBackgroundJobOptions>(options =>
|
||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||
{
|
||||
options.IsJobExecutionEnabled = false;
|
||||
});
|
||||
|
||||
Configure<AbpDistributedCacheOptions>(options =>
|
||||
{
|
||||
options.KeyPrefix = "KonSoft:";
|
||||
});
|
||||
|
||||
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("KonSoft");
|
||||
if (!hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "KonSoft-Protection-Keys");
|
||||
}
|
||||
|
||||
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
|
||||
{
|
||||
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
|
||||
options.IsDynamicClaimsEnabled = true;
|
||||
});
|
||||
|
||||
context.Services.AddCors(options =>
|
||||
@ -145,7 +123,7 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
configuration["App:CorsOrigins"]?
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(o => o.RemovePostFix("/"))
|
||||
.ToArray() ?? []
|
||||
.ToArray() ?? Array.Empty<string>()
|
||||
)
|
||||
.WithAbpExposedHeaders()
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains()
|
||||
@ -154,11 +132,6 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
.AllowCredentials();
|
||||
});
|
||||
});
|
||||
|
||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||
{
|
||||
options.IsDynamicClaimsEnabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||
@ -166,18 +139,21 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
var app = context.GetApplicationBuilder();
|
||||
var env = context.GetEnvironment();
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
app.UseAbpRequestLocalization();
|
||||
|
||||
if (!env.IsDevelopment())
|
||||
{
|
||||
app.UseErrorPage();
|
||||
app.UseForwardedHeaders();
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseForwardedHeaders();
|
||||
}
|
||||
|
||||
app.UseAbpRequestLocalization();
|
||||
|
||||
app.UseCorrelationId();
|
||||
app.UseStaticFiles();
|
||||
app.UseRouting();
|
||||
@ -185,7 +161,7 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
app.UseAuthentication();
|
||||
app.UseAbpOpenIddictValidation();
|
||||
|
||||
if (MultiTenancyConsts.IsEnabled)
|
||||
if (KonSoftConsts.MultiTenancyEnabled)
|
||||
{
|
||||
app.UseMultiTenancy();
|
||||
}
|
||||
@ -198,4 +174,4 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,14 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using KonSoft.Localization;
|
||||
using Volo.Abp.Ui.Branding;
|
||||
using KonSoft.Shared.Localization.Localization;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Ui.Branding;
|
||||
|
||||
namespace KonSoft;
|
||||
|
||||
[Dependency(ReplaceServices = true)]
|
||||
public class KonSoftBrandingProvider : DefaultBrandingProvider
|
||||
{
|
||||
private IStringLocalizer<KonSoftResource> _localizer;
|
||||
private readonly IStringLocalizer<KonSoftResource> _localizer;
|
||||
|
||||
public KonSoftBrandingProvider(IStringLocalizer<KonSoftResource> localizer)
|
||||
{
|
||||
@ -16,4 +16,4 @@ public class KonSoftBrandingProvider : DefaultBrandingProvider
|
||||
}
|
||||
|
||||
public override string AppName => _localizer["AppName"];
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,13 @@
|
||||
@page
|
||||
@using System.Net
|
||||
@using KonSoft.Shared.Localization.Localization
|
||||
@using Microsoft.AspNetCore.Http.Extensions
|
||||
@using Microsoft.AspNetCore.Mvc.Localization
|
||||
@using KonSoft.Pages
|
||||
@using KonSoft.Localization
|
||||
@using Volo.Abp.Users
|
||||
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid
|
||||
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
|
||||
@using Volo.Abp.Ui.Branding
|
||||
@model IndexModel
|
||||
@using Volo.Abp.Users
|
||||
@model KonSoft.Pages.IndexModel
|
||||
@inject IHtmlLocalizer<KonSoftResource> L
|
||||
@inject ICurrentUser CurrentUser
|
||||
@inject IBrandingProvider BrandingProvider
|
||||
@ -45,32 +46,32 @@
|
||||
<abp-row>
|
||||
<abp-column size="_6">
|
||||
<div class="mr-auto p-2 float-start">
|
||||
<div class="">
|
||||
@if (CurrentUser.IsAuthenticated)
|
||||
{
|
||||
<div class="">
|
||||
<a abp-button="Outline_Primary" asp-controller="Manage" asp-action="Index" asp-area="Account" class="me-2">@L["MyAccount"]</a>
|
||||
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account" asp-route-returnUrl="/" >@L["Logout"]</a>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a abp-button="Primary" asp-controller="Login" asp-action="Index" asp-area="Account">@L["Login"]</a>
|
||||
}
|
||||
</div>
|
||||
<div class="">
|
||||
@if (CurrentUser.IsAuthenticated)
|
||||
{
|
||||
<div class="">
|
||||
<a abp-button="Outline_Primary" asp-controller="Manage" asp-action="Index" asp-area="Account" class="me-2">@L["MyAccount"]</a>
|
||||
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account" asp-route-returnUrl="/">@L["Logout"]</a>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a abp-button="Primary" asp-controller="Login" asp-action="Index" asp-area="Account">@L["Login"]</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</abp-column>
|
||||
|
||||
<abp-column size="_6">
|
||||
<div class="ml-auto p-2 float-end">
|
||||
<abp-dropdown>
|
||||
<abp-dropdown-button text="@Model.CurrentLanguage" />
|
||||
@if (@Model.Languages != null)
|
||||
<abp-dropdown-button text="@Model.CurrentLanguage"/>
|
||||
@if (Model.Languages != null)
|
||||
{
|
||||
<abp-dropdown-menu>
|
||||
@foreach (var language in Model.Languages)
|
||||
{
|
||||
var languageUrl = Url.Content($"~/Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={System.Net.WebUtility.UrlEncode(Request.GetEncodedPathAndQuery())}");
|
||||
var languageUrl = Url.Content($"~/Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={WebUtility.UrlEncode(Request.GetEncodedPathAndQuery())}");
|
||||
<abp-dropdown-item href="@languageUrl">@language.DisplayName</abp-dropdown-item>
|
||||
}
|
||||
</abp-dropdown-menu>
|
||||
@ -82,18 +83,18 @@
|
||||
|
||||
@if (Model.Applications != null)
|
||||
{
|
||||
<hr class="m-2" />
|
||||
<hr class="m-2"/>
|
||||
|
||||
<abp-row class="mt-3">
|
||||
@foreach (var application in Model.Applications)
|
||||
{
|
||||
<abp-column size-md="@Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid.ColumnSize._4" class="mb-2">
|
||||
<abp-column size-md="@ColumnSize._4" class="mb-2">
|
||||
<abp-card>
|
||||
<abp-card-body>
|
||||
@{
|
||||
var clientUri = application.ClientUri.Contains("Swagger") ? application.ClientUri.EnsureEndsWith('/') + "swagger/index.html" : application.ClientUri;
|
||||
@{
|
||||
var clientUri = application.ClientUri.Contains("Swagger") ? application.ClientUri.EnsureEndsWith('/') + "swagger/index.html" : application.ClientUri;
|
||||
}
|
||||
|
||||
|
||||
@if (!application.LogoUri.IsNullOrEmpty())
|
||||
{
|
||||
<div class="mx-auto">
|
||||
@ -115,4 +116,4 @@
|
||||
</div>
|
||||
</abp-row>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -9,6 +9,12 @@ namespace KonSoft.Pages;
|
||||
|
||||
public class IndexModel : AbpPageModel
|
||||
{
|
||||
public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider)
|
||||
{
|
||||
OpenIdApplicationRepository = openIdApplicationRepository;
|
||||
LanguageProvider = languageProvider;
|
||||
}
|
||||
|
||||
public List<OpenIddictApplication>? Applications { get; protected set; }
|
||||
|
||||
public IReadOnlyList<LanguageInfo>? Languages { get; protected set; }
|
||||
@ -19,12 +25,6 @@ public class IndexModel : AbpPageModel
|
||||
|
||||
protected ILanguageProvider LanguageProvider { get; }
|
||||
|
||||
public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider)
|
||||
{
|
||||
OpenIdApplicationRepository = openIdApplicationRepository;
|
||||
LanguageProvider = languageProvider;
|
||||
}
|
||||
|
||||
public async Task OnGetAsync()
|
||||
{
|
||||
Applications = await OpenIdApplicationRepository.GetListAsync();
|
||||
@ -32,4 +32,4 @@ public class IndexModel : AbpPageModel
|
||||
Languages = await LanguageProvider.GetLanguagesAsync();
|
||||
CurrentLanguage = CultureInfo.CurrentCulture.DisplayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,56 +1,37 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KonSoft;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
.MinimumLevel.Debug()
|
||||
#else
|
||||
.MinimumLevel.Information()
|
||||
#endif
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
||||
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.Async(c => c.File("Logs/logs.txt"))
|
||||
.WriteTo.Async(c => c.Console())
|
||||
.CreateLogger();
|
||||
var assemblyName = typeof(Program).Assembly.GetName().Name!;
|
||||
|
||||
SerilogConfigurationHelper.Configure(assemblyName);
|
||||
try
|
||||
{
|
||||
Log.Information("Starting KonSoft.AuthServer.");
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Host.AddAppSettingsSecretsJson()
|
||||
.UseAutofac()
|
||||
.UseSerilog();
|
||||
await builder.AddApplicationAsync<KonSoftAuthServerModule>();
|
||||
var app = builder.Build();
|
||||
Log.Information($"Starting {assemblyName}.");
|
||||
var app = await ApplicationBuilderHelper
|
||||
.BuildApplicationAsync<KonSoftAuthServerModule>(args);
|
||||
await app.InitializeApplicationAsync();
|
||||
app.MapGet("/heath", () => "Online");
|
||||
await app.RunAsync();
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is HostAbortedException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
Log.Fatal(ex, "KonSoft.AuthServer terminated unexpectedly!");
|
||||
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!");
|
||||
return 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.CloseAndFlush();
|
||||
await Log.CloseAndFlushAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,6 @@
|
||||
{
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"KonSoft.AuthServer": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
@ -27,12 +20,5 @@
|
||||
"useSSL": true
|
||||
}
|
||||
},
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44322",
|
||||
"sslPort": 44322
|
||||
}
|
||||
}
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json"
|
||||
}
|
||||
@ -1,17 +1,8 @@
|
||||
{
|
||||
"App": {
|
||||
"SelfUrl": "https://localhost:44322",
|
||||
"ClientUrl": "http://localhost:4200",
|
||||
"CorsOrigins": "https://*.KonSoft.com,http://localhost:4200,https://localhost:44316,https://localhost:44370",
|
||||
"RedirectAllowedUrls": "http://localhost:4200,https://localhost:44319,https://localhost:44316,https://localhost:44347"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Default": "Host=localhost;Port=5432;Database=KonSoft;User ID=root;Password=myPassword;"
|
||||
},
|
||||
"Redis": {
|
||||
"Configuration": "127.0.0.1"
|
||||
},
|
||||
"StringEncryption": {
|
||||
"DefaultPassPhrase": "kxtywyrXW4i7vijT"
|
||||
"AgileConfig": {
|
||||
"appId": "KonSoft.Admin.HttpApi.Host",
|
||||
"name": "KonSoft.Admin.HttpApi.Host",
|
||||
"nodes": "https://config.konsoft.top/",
|
||||
"secret": "DBE31703-14F9-4B01-893D-900B8380CE04"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.AuthServer.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.AuthServer.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -1,322 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@abp/aspnetcore.mvc.ui.theme.basic@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-8.3.4.tgz#75708276b2d9162d4f208ebf566fb0a7343636a7"
|
||||
integrity sha512-m5NBySj8tPbXwMKI1hUfYDzGVxvcU4JGJsSDegetuiulZYm59tPnfdwBeM0zSqx72UPowu/2oDwJsgjODVrDlg==
|
||||
dependencies:
|
||||
"@abp/aspnetcore.mvc.ui.theme.shared" "~8.3.4"
|
||||
|
||||
"@abp/aspnetcore.mvc.ui.theme.shared@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-8.3.4.tgz#169ae0893302ced9256f94174d9bb870e49f446c"
|
||||
integrity sha512-bZy8iAIN0QfNJXCRg+RR1NxqTzNDSXRPBx+ksFtDxY6FzMJvwwSOmHF0wqsMLj1xpwXjijWaVWQ2RM/7scDWmw==
|
||||
dependencies:
|
||||
"@abp/aspnetcore.mvc.ui" "~8.3.4"
|
||||
"@abp/bootstrap" "~8.3.4"
|
||||
"@abp/bootstrap-datepicker" "~8.3.4"
|
||||
"@abp/bootstrap-daterangepicker" "~8.3.4"
|
||||
"@abp/datatables.net-bs5" "~8.3.4"
|
||||
"@abp/font-awesome" "~8.3.4"
|
||||
"@abp/jquery-form" "~8.3.4"
|
||||
"@abp/jquery-validation-unobtrusive" "~8.3.4"
|
||||
"@abp/lodash" "~8.3.4"
|
||||
"@abp/luxon" "~8.3.4"
|
||||
"@abp/malihu-custom-scrollbar-plugin" "~8.3.4"
|
||||
"@abp/moment" "~8.3.4"
|
||||
"@abp/select2" "~8.3.4"
|
||||
"@abp/sweetalert2" "~8.3.4"
|
||||
"@abp/timeago" "~8.3.4"
|
||||
"@abp/toastr" "~8.3.4"
|
||||
|
||||
"@abp/aspnetcore.mvc.ui@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-8.3.4.tgz#041d83f34541081d9e0f37c36c302cbe871a4897"
|
||||
integrity sha512-sjGE/EoNM98mXNYPze2C7GPP+TNpv4TLIt416ojaqtxru60oddr4VWrOGuhaqUCO2jJes3OwFZi5PY3hVOBbYw==
|
||||
dependencies:
|
||||
ansi-colors "^4.1.3"
|
||||
|
||||
"@abp/bootstrap-datepicker@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-8.3.4.tgz#072f4a3cea93e3a1bb1de13b355201648929f84c"
|
||||
integrity sha512-txilFovf9zT1w+fTkyI3eZdiISjaxc/+wRRFKwrkVH+0xEgaiR41svKm6sjWBORxgTddlGas87SZJvYY3IKBjA==
|
||||
dependencies:
|
||||
bootstrap-datepicker "^1.10.0"
|
||||
|
||||
"@abp/bootstrap-daterangepicker@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/bootstrap-daterangepicker/-/bootstrap-daterangepicker-8.3.4.tgz#b0f65611ca4fafdf2b551f9f139868eae6e22e9a"
|
||||
integrity sha512-bYkYjk1zTdWcM4DGwnDoU+4pDvs1S8hkNWhrnpP0o8oRoJiesO8Aeda+82rtydtWnxHg+HkDC0iYFFqaNuHvbg==
|
||||
dependencies:
|
||||
bootstrap-daterangepicker "^3.1.0"
|
||||
|
||||
"@abp/bootstrap@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-8.3.4.tgz#744bb4d30d4c269ce8e6a7d16c6777dd3cd9fe1e"
|
||||
integrity sha512-GXCLFFmPNaR3DjQYSaqACL5sH/M9FPia2OKAAMOd796+NmcoFpT+S7l4C6ihqeQc4bjFm0voB8QklueGWx6r8A==
|
||||
dependencies:
|
||||
"@abp/core" "~8.3.4"
|
||||
bootstrap "^5.3.3"
|
||||
|
||||
"@abp/core@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/core/-/core-8.3.4.tgz#12635bc2ac325a426334150502a32fefa4ec3767"
|
||||
integrity sha512-wImAdZABahaQe6mmZAZlPfYZ3PEhL7eEq+18c1WFO0xeD98oxqi8H1X7+3ABjyFscIh9LIxJVaD3RJ9OHCc5bw==
|
||||
dependencies:
|
||||
"@abp/utils" "~8.3.4"
|
||||
|
||||
"@abp/datatables.net-bs5@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs5/-/datatables.net-bs5-8.3.4.tgz#efc28fa57144c7b495a4aeea38df962807ca20df"
|
||||
integrity sha512-u85aXjqYIJJfOsMq6oNqfxNgxQqV6vOEnJ32vrH294ceW8RzUxHA+G/ZkGRLLRGWVuxuARD/UXzEotH5sd1Ssw==
|
||||
dependencies:
|
||||
"@abp/datatables.net" "~8.3.4"
|
||||
datatables.net-bs5 "^2.0.8"
|
||||
|
||||
"@abp/datatables.net@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-8.3.4.tgz#23a3155a2d84247a29a6b80ff98d1d5f6422a245"
|
||||
integrity sha512-cwE9TFoRoszmI3zNVaYJtqjSPtwkL9dhCfE02zsmJo8GBdFAlbzAmQenfQiWb3BZhvUvKKN20e+og9S8qoCbXA==
|
||||
dependencies:
|
||||
"@abp/jquery" "~8.3.4"
|
||||
datatables.net "^2.0.8"
|
||||
|
||||
"@abp/font-awesome@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-8.3.4.tgz#f79f7b439f9ffadfc03be3a415a977eab21fa5a1"
|
||||
integrity sha512-5+D5XKnrZROtg9PJ2zex52gbphXGK/7ZIUsszEg8rOIc/niXggaZLmuDcYJwOEzIkwpGO9OvYy7lc0tHv/Pr4g==
|
||||
dependencies:
|
||||
"@abp/core" "~8.3.4"
|
||||
"@fortawesome/fontawesome-free" "^6.5.2"
|
||||
|
||||
"@abp/jquery-form@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-8.3.4.tgz#c1705bd5213ab5c2b895dd5bd9f3e54f3d94cf54"
|
||||
integrity sha512-vFjWbTbHQyIsk5SS7Cc+5YrJ15ORjJU+YWVPchI0qoug26for06a7lDGpazWMadxx3iPL7cKLqneOqaVtHkgJA==
|
||||
dependencies:
|
||||
"@abp/jquery" "~8.3.4"
|
||||
jquery-form "^4.3.0"
|
||||
|
||||
"@abp/jquery-validation-unobtrusive@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-8.3.4.tgz#e89eafed89787bcb5221c0ba89832b79a7396d19"
|
||||
integrity sha512-+kJA5vfvxkrj/iW4Q84BrMTrAGOhC2Hb5czAKr6c60Prmayk5hcakZdXc3wDBHREBLVAq1Muk4AtEJZmaKIeaA==
|
||||
dependencies:
|
||||
"@abp/jquery-validation" "~8.3.4"
|
||||
jquery-validation-unobtrusive "^4.0.0"
|
||||
|
||||
"@abp/jquery-validation@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-8.3.4.tgz#a445592d80edc6b6b1334ece2007b3084c329cc6"
|
||||
integrity sha512-XvL0H3IRuSHwpPKUyJmW6PH8KwPDt9NllMqPGreRANF8l5IU10hOLEeP2BnGFfGMqFwqUMh+eJRar5yZcegkmg==
|
||||
dependencies:
|
||||
"@abp/jquery" "~8.3.4"
|
||||
jquery-validation "^1.20.1"
|
||||
|
||||
"@abp/jquery@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-8.3.4.tgz#2dc3f5f124ac65b5f45d29749ebb5d6cf17db23b"
|
||||
integrity sha512-Zx2rErtgc0gxjX5PURjp6sjDQfzxBChUE9YWN37Xh+Ysm3tTGcXlF0Emwl94MZ640NfmYRpG4AWdik6kbaU5Wg==
|
||||
dependencies:
|
||||
"@abp/core" "~8.3.4"
|
||||
jquery "~3.7.1"
|
||||
|
||||
"@abp/lodash@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-8.3.4.tgz#b0ef4e82a788ae7389a31793c3bad6702efdbe33"
|
||||
integrity sha512-yGd/oLds0jpTgTpmkFYOEomS4K15DGcffMP3N1t0qKLgTaBYTQzeugHVgQ0baufC+OvLjumDNuu3eHjBJewwKg==
|
||||
dependencies:
|
||||
"@abp/core" "~8.3.4"
|
||||
lodash "^4.17.21"
|
||||
|
||||
"@abp/luxon@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-8.3.4.tgz#f152b2d7b62bd27f3d27aa3a1794b868bf06a1a4"
|
||||
integrity sha512-l1nvfqdhHBgHBPK+bLClAEprRK3K5zx5Jar93o5++6r3zXUhYi5OUHUxl+LuGn8MXLvHJVGL41irHl6sYjFSww==
|
||||
dependencies:
|
||||
"@abp/core" "~8.3.4"
|
||||
luxon "^3.4.4"
|
||||
|
||||
"@abp/malihu-custom-scrollbar-plugin@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-8.3.4.tgz#0868214884e3e0b94dade0e8e78c01741d71106a"
|
||||
integrity sha512-uKRk8+HCvXtpmvof5W09908AkivlweErTE62b0JhkrJVIlYt/0LC1MmB/qHHBfPj6OK05HYGBi3inr7fNAPXEQ==
|
||||
dependencies:
|
||||
"@abp/core" "~8.3.4"
|
||||
malihu-custom-scrollbar-plugin "^3.1.5"
|
||||
|
||||
"@abp/moment@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/moment/-/moment-8.3.4.tgz#a5809520dc50b50402ade4ac630c6ec985fd4518"
|
||||
integrity sha512-61J8drO3OqkaaAn66xBg6jCws1iV6zutjYQvpEXLdGBA9Kvw2J87GSomxJ4mcIo/5+jzrVro6JYaCfKWY8b1dw==
|
||||
dependencies:
|
||||
moment "^2.30.1"
|
||||
|
||||
"@abp/select2@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-8.3.4.tgz#1731b465760e0515d0d4280f38189c9366fecda5"
|
||||
integrity sha512-sPtYstFVvMTT8fdXRIfHeODIgSN2ufWm6zCMGH7C0cST3FF59M4m/MtdKGBlA/itzHPxeDv7A6dy4Aw4l7Gk4Q==
|
||||
dependencies:
|
||||
"@abp/core" "~8.3.4"
|
||||
select2 "^4.0.13"
|
||||
|
||||
"@abp/sweetalert2@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/sweetalert2/-/sweetalert2-8.3.4.tgz#c0768ca4fe0a9926b8f33d8bf5251d3e4202cd2f"
|
||||
integrity sha512-6HqxISh+FodwUsCrR3nX49RQDhzHtDlz8ul42TecUMsGa96qX2lvwnoWkXAHLG3mdLRy62Z0dhJ1JKMfrPeJeg==
|
||||
dependencies:
|
||||
"@abp/core" "~8.3.4"
|
||||
sweetalert2 "^11.3.6"
|
||||
|
||||
"@abp/timeago@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-8.3.4.tgz#26ca0bec90d861f9f4af714061b370950551c839"
|
||||
integrity sha512-cDARYysPn5Rr/9rqVn7S4sBWbeEpaIXr8NKwGZqNOzMF2g283SkLKrkQJBWIC6Pn2lVeIB7AV1+GtVn81V/nnw==
|
||||
dependencies:
|
||||
"@abp/jquery" "~8.3.4"
|
||||
timeago "^1.6.7"
|
||||
|
||||
"@abp/toastr@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-8.3.4.tgz#cb433bc4ed2e302f2704ad0456c99d6f12fd0529"
|
||||
integrity sha512-29C9GgwlumrHgt1iZ4lArDnlXfSvmCHDehxkbDutrkC1m257UxQaOID11us2UeCs3JobueQcLlQKD/LqnDB4xA==
|
||||
dependencies:
|
||||
"@abp/jquery" "~8.3.4"
|
||||
toastr "^2.1.4"
|
||||
|
||||
"@abp/utils@~8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-8.3.4.tgz#4b06575a110e85e2a360294f678b782818e1ab10"
|
||||
integrity sha512-7Lq3wdk/07vKgQnR56DTmdSuYRABMe0XTGPJRS5F91DVbggeJyDUaqifVvOeurF/3CZJOS7fJpoIHQXeUveFtQ==
|
||||
dependencies:
|
||||
just-compare "^2.3.0"
|
||||
|
||||
"@fortawesome/fontawesome-free@^6.5.2":
|
||||
version "6.7.2"
|
||||
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.7.2.tgz#8249de9b7e22fcb3ceb5e66090c30a1d5492b81a"
|
||||
integrity sha512-JUOtgFW6k9u4Y+xeIaEiLr3+cjoUPiAuLXoyKOJSia6Duzb7pq+A76P9ZdPDoAoxHdHzq6gE9/jKBGXlZT8FbA==
|
||||
|
||||
ansi-colors@^4.1.3:
|
||||
version "4.1.3"
|
||||
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b"
|
||||
integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==
|
||||
|
||||
bootstrap-datepicker@^1.10.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/bootstrap-datepicker/-/bootstrap-datepicker-1.10.0.tgz#61612bbe8bf0a69a5bce32bbcdda93ebb6ccf24a"
|
||||
integrity sha512-lWxtSYddAQOpbAO8UhYhHLcK6425eWoSjb5JDvZU3ePHEPF6A3eUr51WKaFy4PccU19JRxUG6wEU3KdhtKfvpg==
|
||||
dependencies:
|
||||
jquery ">=3.4.0 <4.0.0"
|
||||
|
||||
bootstrap-daterangepicker@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/bootstrap-daterangepicker/-/bootstrap-daterangepicker-3.1.0.tgz#632e6fb2de4b6360c5c0a9d5f6adb9aace051fe8"
|
||||
integrity sha512-oaQZx6ZBDo/dZNyXGVi2rx5GmFXThyQLAxdtIqjtLlYVaQUfQALl5JZMJJZzyDIX7blfy4ppZPAJ10g8Ma4d/g==
|
||||
dependencies:
|
||||
jquery ">=1.10"
|
||||
moment "^2.9.0"
|
||||
|
||||
bootstrap@^5.3.3:
|
||||
version "5.3.8"
|
||||
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-5.3.8.tgz#6401a10057a22752d21f4e19055508980656aeed"
|
||||
integrity sha512-HP1SZDqaLDPwsNiqRqi5NcP0SSXciX2s9E+RyqJIIqGo+vJeN5AJVM98CXmW/Wux0nQ5L7jeWUdplCEf0Ee+tg==
|
||||
|
||||
datatables.net-bs5@^2.0.8:
|
||||
version "2.3.3"
|
||||
resolved "https://registry.yarnpkg.com/datatables.net-bs5/-/datatables.net-bs5-2.3.3.tgz#8bf3aec484a69e373f6007038eaac0cc0ef4ee15"
|
||||
integrity sha512-IPtC57k3KyZaLzIYTHies23Cm2zqaKfD6lkxy/aOAUUAtsg35l53VqNY9y84AEySYG3YLghMHVBvl2ckUhvm0A==
|
||||
dependencies:
|
||||
datatables.net "2.3.3"
|
||||
jquery ">=1.7"
|
||||
|
||||
datatables.net@2.3.3, datatables.net@^2.0.8:
|
||||
version "2.3.3"
|
||||
resolved "https://registry.yarnpkg.com/datatables.net/-/datatables.net-2.3.3.tgz#fe4f96bdbc4cf47c8d11162a7af525ca6a3683d2"
|
||||
integrity sha512-SWL3za6nheY6gdoiLgCc++tYmxbwrmv2bjrEiII9rXBWXXSbOZct6pjR3FueMVRM5jmt7pQcXiGovfuFDnutQg==
|
||||
dependencies:
|
||||
jquery ">=1.7"
|
||||
|
||||
jquery-form@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/jquery-form/-/jquery-form-4.3.0.tgz#7d3961c314a1f2d15298f4af1d3943f54f4149c6"
|
||||
integrity sha512-q3uaVCEWdLOYUCI6dpNdwf/7cJFOsUgdpq6r0taxtGQ5NJSkOzofyWm4jpOuJ5YxdmL1FI5QR+q+HB63HHLGnQ==
|
||||
dependencies:
|
||||
jquery ">=1.7.2"
|
||||
|
||||
jquery-mousewheel@>=3.0.6:
|
||||
version "3.2.2"
|
||||
resolved "https://registry.yarnpkg.com/jquery-mousewheel/-/jquery-mousewheel-3.2.2.tgz#48c833f6260ee0c46d438a999e7d0060ec9eed0b"
|
||||
integrity sha512-JP71xTAg08ZY3hcs9ZbYUZ5i+dkSsz4yRl/zpWkAmtzc+kMs5EfPkpkINSidiLYMaR0MTo3DfFGF9WIezMsFQQ==
|
||||
dependencies:
|
||||
jquery ">=1.2.6"
|
||||
|
||||
jquery-validation-unobtrusive@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.0.0.tgz#dfcf25a558496a2c883db6021d10f5398d15f99d"
|
||||
integrity sha512-1ervYFFv6LX/rp7ktuLnMakHNG0piNRDyROI8Ir3hL1vPIwylAehB1AY3BPrYJnzW3WmwWryZq+Bz4sazZK9iQ==
|
||||
dependencies:
|
||||
jquery "^3.6.0"
|
||||
jquery-validation ">=1.19"
|
||||
|
||||
jquery-validation@>=1.19, jquery-validation@^1.20.1:
|
||||
version "1.21.0"
|
||||
resolved "https://registry.yarnpkg.com/jquery-validation/-/jquery-validation-1.21.0.tgz#78fc05ab76020912a246af3661b3f54a438bca93"
|
||||
integrity sha512-xNot0rlUIgu7duMcQ5qb6MGkGL/Z1PQaRJQoZAURW9+a/2PGOUxY36o/WyNeP2T9R6jvWB8Z9lUVvvQWI/Zs5w==
|
||||
|
||||
jquery@>=1.10, jquery@>=1.12.0, jquery@>=1.2.6, "jquery@>=1.5.0 <4.0", jquery@>=1.7, jquery@>=1.7.2, "jquery@>=3.4.0 <4.0.0", jquery@^3.6.0, jquery@~3.7.1:
|
||||
version "3.7.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de"
|
||||
integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==
|
||||
|
||||
just-compare@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/just-compare/-/just-compare-2.3.0.tgz#a2adcc1d1940536263275f5a1ef1298bcacfeda7"
|
||||
integrity sha512-6shoR7HDT+fzfL3gBahx1jZG3hWLrhPAf+l7nCwahDdT9XDtosB9kIF0ZrzUp5QY8dJWfQVr5rnsPqsbvflDzg==
|
||||
|
||||
lodash@^4.17.21:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
||||
luxon@^3.4.4:
|
||||
version "3.7.2"
|
||||
resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.7.2.tgz#d697e48f478553cca187a0f8436aff468e3ba0ba"
|
||||
integrity sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==
|
||||
|
||||
malihu-custom-scrollbar-plugin@^3.1.5:
|
||||
version "3.1.5"
|
||||
resolved "https://registry.yarnpkg.com/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-3.1.5.tgz#310cecc5e59415a1c29e9dfb5d2b6e01d66a29ef"
|
||||
integrity sha512-lwW3LgI+CNDMPnP4ED2la6oYxWMkCXlnhex+s2wuOLhFDFGnGmQuTQVdRK9bvDLpxs10sGlfErVufJy9ztfgJQ==
|
||||
dependencies:
|
||||
jquery-mousewheel ">=3.0.6"
|
||||
|
||||
moment@^2.30.1, moment@^2.9.0:
|
||||
version "2.30.1"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
|
||||
integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==
|
||||
|
||||
select2@^4.0.13:
|
||||
version "4.0.13"
|
||||
resolved "https://registry.yarnpkg.com/select2/-/select2-4.0.13.tgz#0dbe377df3f96167c4c1626033e924372d8ef44d"
|
||||
integrity sha512-1JeB87s6oN/TDxQQYCvS5EFoQyvV6eYMZZ0AeA4tdFDYWN3BAGZ8npr17UBFddU0lgAt3H0yjX3X6/ekOj1yjw==
|
||||
|
||||
sweetalert2@^11.3.6:
|
||||
version "11.23.0"
|
||||
resolved "https://registry.yarnpkg.com/sweetalert2/-/sweetalert2-11.23.0.tgz#ba8a051b1e94215c762af08692171b7b4611c4c1"
|
||||
integrity sha512-cKzzbC3C1sIs7o9XAMw4E8F9kBtGXsBDUsd2JZ8JM/dqa+nzWwSGM+9LLYILZWzWHzX9W+HJNHyBlbHPVS/krw==
|
||||
|
||||
timeago@^1.6.7:
|
||||
version "1.6.7"
|
||||
resolved "https://registry.yarnpkg.com/timeago/-/timeago-1.6.7.tgz#afd467c29a911e697fc22a81888c7c3022783cb5"
|
||||
integrity sha512-FikcjN98+ij0siKH4VO4dZ358PR3oDDq4Vdl1+sN9gWz1/+JXGr3uZbUShYH/hL7bMhcTpPbplJU5Tej4b4jbQ==
|
||||
dependencies:
|
||||
jquery ">=1.5.0 <4.0"
|
||||
|
||||
toastr@^2.1.4:
|
||||
version "2.1.4"
|
||||
resolved "https://registry.yarnpkg.com/toastr/-/toastr-2.1.4.tgz#8b43be64fb9d0c414871446f2db8e8ca4e95f181"
|
||||
integrity sha512-LIy77F5n+sz4tefMmFOntcJ6HL0Fv3k1TDnNmFZ0bU/GcvIIfy6eG2v7zQmMiYgaalAiUv75ttFrPn5s0gyqlA==
|
||||
dependencies:
|
||||
jquery ">=1.12.0"
|
||||
@ -1,33 +1,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace KonSoft.BackgroundJobs.Controllers
|
||||
namespace KonSoft.BackgroundJobs.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,4 +22,4 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
@ -1,13 +1,5 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:4773",
|
||||
"sslPort": 44380
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
@ -18,24 +10,6 @@
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7094;http://localhost:5243",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
namespace KonSoft.BackgroundJobs
|
||||
namespace KonSoft.BackgroundJobs;
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
@ -1,33 +1,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace KonSoft.BackgroundWorker.Controllers
|
||||
namespace KonSoft.BackgroundWorker.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,4 +22,4 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
@ -1,13 +1,5 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:22937",
|
||||
"sslPort": 44300
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
@ -18,24 +10,6 @@
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7183;http://localhost:5074",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
namespace KonSoft.BackgroundWorker
|
||||
namespace KonSoft.BackgroundWorker;
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
27
authserver.Jenkinsfile
Normal file
27
authserver.Jenkinsfile
Normal file
@ -0,0 +1,27 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
sh '/usr/libexec/docker/cli-plugins/docker-compose -f ./docker-compose.yml up --build -d authserver'
|
||||
} catch (Exception e) {
|
||||
error "部署失败: ${e.message}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Health Check') {
|
||||
steps {
|
||||
script {
|
||||
sleep time: 30, unit: 'SECONDS'
|
||||
sh 'docker ps | grep authserver'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
90
docker-compose.yml
Normal file
90
docker-compose.yml
Normal file
@ -0,0 +1,90 @@
|
||||
services:
|
||||
internalgateways:
|
||||
container_name: clean-internalgateways
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./gateways/KonSoft.InternalGateway/Dockerfile
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Test
|
||||
- AgileConfig__AppId=KonSoft.InternalGateway
|
||||
- AgileConfig__Name=KonSoft.InternalGateway
|
||||
- AgileConfig__Nodes=https://config.konsoft.top/
|
||||
- AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04
|
||||
ports:
|
||||
- 8080:8080
|
||||
networks:
|
||||
- konsoft-shared-network
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
authserver:
|
||||
container_name: clean-authserver
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./applications/KonSoft.AuthServer/Dockerfile
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Test
|
||||
- AgileConfig__AppId=KonSoft.AuthServer
|
||||
- AgileConfig__Name=KonSoft.AuthServer
|
||||
- AgileConfig__Nodes=https://config.konsoft.top/
|
||||
- AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04
|
||||
ports:
|
||||
- 8081:8080
|
||||
volumes:
|
||||
- /etc/letsencrypt/archive/code.konsoft.top/openiddict.pfx:/app/openiddict.pfx
|
||||
networks:
|
||||
- konsoft-shared-network
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
adminservice:
|
||||
container_name: clean-adminservice
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./microservices/KonSoft.Admin.HttpApi.Host/Dockerfile
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Test
|
||||
- AgileConfig__AppId=KonSoft.Admin.HttpApi.Host
|
||||
- AgileConfig__Name=KonSoft.Admin.HttpApi.Host
|
||||
- AgileConfig__Nodes=https://config.konsoft.top/
|
||||
- AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04
|
||||
networks:
|
||||
- konsoft-shared-network
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
networks:
|
||||
konsoft-shared-network:
|
||||
name: konsoft-shared-network
|
||||
driver: bridge
|
||||
external: true
|
||||
@ -1,33 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace KonSoft.InternalGateway.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
gateways/KonSoft.InternalGateway/Dockerfile
Normal file
28
gateways/KonSoft.InternalGateway/Dockerfile
Normal file
@ -0,0 +1,28 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["NuGet.Config", "."]
|
||||
COPY ["gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj", "gateways/KonSoft.InternalGateway/"]
|
||||
COPY ["shared/KonSoft.Shared.Hosting.Gateways/KonSoft.Shared.Hosting.Gateways.csproj", "shared/KonSoft.Shared.Hosting.Gateways/"]
|
||||
COPY ["shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj", "shared/KonSoft.Shared.Hosting.AspNetCore/"]
|
||||
COPY ["shared/KonSoft.Shared.Hosting/KonSoft.Shared.Hosting.csproj", "shared/KonSoft.Shared.Hosting/"]
|
||||
COPY ["shared/KonSoft.Shared.Localization/KonSoft.Shared.Localization.csproj", "shared/KonSoft.Shared.Localization/"]
|
||||
RUN dotnet restore "./gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/gateways/KonSoft.InternalGateway"
|
||||
RUN dotnet build "./KonSoft.InternalGateway.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./KonSoft.InternalGateway.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "KonSoft.InternalGateway.dll"]
|
||||
@ -0,0 +1,50 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Yarp.ReverseProxy.Configuration;
|
||||
namespace KonSoft.InternalGateway.Extensions
|
||||
{
|
||||
public static class YarpSwaggerUIBuilderExtensions
|
||||
{
|
||||
public static IApplicationBuilder UseSwaggerUIWithYarp(this IApplicationBuilder app)
|
||||
{
|
||||
var serviceProvider = app.ApplicationServices;
|
||||
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(options =>
|
||||
{
|
||||
var configuration = serviceProvider.GetRequiredService<IConfiguration>();
|
||||
var logger = serviceProvider.GetRequiredService<ILogger<Program>>();
|
||||
var proxyConfigProvider = serviceProvider.GetRequiredService<IProxyConfigProvider>();
|
||||
var yarpConfig = proxyConfigProvider.GetConfig();
|
||||
|
||||
var routedClusters = yarpConfig.Clusters
|
||||
.SelectMany(t => t.Destinations,
|
||||
(clusterId, destination) => new { clusterId.ClusterId, destination.Value });
|
||||
|
||||
var groupedClusters = routedClusters
|
||||
.GroupBy(q => q.Value.Address)
|
||||
.Select(t => t.First())
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var gatewayUrl = configuration["GatewayUrl"];
|
||||
|
||||
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
|
||||
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
|
||||
foreach (var clusterGroup in groupedClusters)
|
||||
{
|
||||
var routeConfig = yarpConfig.Routes.FirstOrDefault(q =>
|
||||
q.ClusterId == clusterGroup.ClusterId);
|
||||
if (routeConfig == null)
|
||||
{
|
||||
logger.LogWarning($"Swagger UI: Couldn't find route configuration for {clusterGroup.ClusterId}...");
|
||||
continue;
|
||||
}
|
||||
|
||||
// options.SwaggerEndpoint($"{clusterGroup.Value.Address}/swagger/v1/swagger.json", $"{routeConfig.RouteId} API");
|
||||
options.SwaggerEndpoint(new Uri(new Uri(!string.IsNullOrWhiteSpace(gatewayUrl)? gatewayUrl: clusterGroup.Value.Address), $"{routeConfig.RouteId.Split("-")[0]}/swagger/v1/swagger.json").AbsoluteUri, $"{routeConfig.RouteId} API");
|
||||
}
|
||||
});
|
||||
|
||||
return app;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
gateways/KonSoft.InternalGateway/InternalGatewayModule.cs
Normal file
14
gateways/KonSoft.InternalGateway/InternalGatewayModule.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using KonSoft.Admin;
|
||||
using KonSoft.Shared.Hosting.Gateways;
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
namespace KonSoft.InternalGateway
|
||||
{
|
||||
[DependsOn(
|
||||
typeof(KonSoftSharedHostingGatewaysModule),
|
||||
typeof(AdminHttpApiModule)
|
||||
)]
|
||||
public class InternalGatewayModule : AbpModule
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -4,10 +4,14 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>98521e87-fe4a-4555-8c3b-e83559a64e03</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>..\..</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
|
||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.HttpApi\KonSoft.Admin.HttpApi.csproj" />
|
||||
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Gateways\KonSoft.Shared.Hosting.Gateways.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,25 +1,58 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
using KonSoft.InternalGateway;
|
||||
using KonSoft.InternalGateway.Extensions;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using Microsoft.AspNetCore.Rewrite;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Serilog;
|
||||
|
||||
// Add services to the container.
|
||||
var assemblyName = typeof(Program).Assembly.GetName().Name!;
|
||||
SerilogConfigurationHelper.Configure(assemblyName);
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// 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())
|
||||
try
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Configuration
|
||||
.AddAgileConfig(option =>
|
||||
{
|
||||
option.ENV = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development";
|
||||
});
|
||||
builder.Host
|
||||
.AddAppSettingsSecretsJson()
|
||||
.UseAutofac()
|
||||
.UseSerilog();
|
||||
|
||||
builder.Services.AddAbpSwaggerGenWithOidc(builder.Configuration["AuthServer:Authority"]!, setupAction: options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo
|
||||
{
|
||||
Title = "Gateway",
|
||||
Version = "v1"
|
||||
});
|
||||
options.DocInclusionPredicate((docName, description) => true);
|
||||
options.CustomSchemaIds(type => type.FullName);
|
||||
});
|
||||
|
||||
|
||||
builder.Services.AddReverseProxy()
|
||||
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
|
||||
builder.Services.AddControllers();
|
||||
await builder.AddApplicationAsync<InternalGatewayModule>();
|
||||
var app = builder.Build();
|
||||
await app.InitializeApplicationAsync();
|
||||
app.UseSwaggerUIWithYarp();
|
||||
app.MapReverseProxy();
|
||||
app.MapGet("/heath", () => "Online");
|
||||
await app.RunAsync();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!");
|
||||
return 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Log.CloseAndFlushAsync();
|
||||
}
|
||||
@ -1,33 +1,24 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:15968",
|
||||
"sslPort": 44395
|
||||
}
|
||||
},
|
||||
{
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5090",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5090"
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7264;http://localhost:5090",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://localhost:7264;http://localhost:5090"
|
||||
},
|
||||
"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:15968",
|
||||
"sslPort": 44395
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
namespace KonSoft.InternalGateway
|
||||
{
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
"AgileConfig": {
|
||||
"appId": "KonSoft.InternalGateway",
|
||||
"name": "KonSoft.InternalGateway",
|
||||
"nodes": "https://config.konsoft.top/",
|
||||
"secret": "DBE31703-14F9-4B01-893D-900B8380CE04"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AuthServer": {
|
||||
"Authority": "https://devauth.konsoft.top",
|
||||
"RequireHttpsMetadata": true,
|
||||
"SwaggerClientId": "Gateway_Swagger"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,33 +1,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace KonSoft.PublicGateway.Controllers
|
||||
namespace KonSoft.PublicGateway.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,4 +22,4 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
@ -1,13 +1,12 @@
|
||||
namespace KonSoft.PublicGateway
|
||||
namespace KonSoft.PublicGateway;
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
27
internalgateway.Jenkinsfile
Normal file
27
internalgateway.Jenkinsfile
Normal file
@ -0,0 +1,27 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
sh '/usr/libexec/docker/cli-plugins/docker-compose -f ./docker-compose.yml up --build -d internalgateways'
|
||||
} catch (Exception e) {
|
||||
error "部署失败: ${e.message}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Health Check') {
|
||||
steps {
|
||||
script {
|
||||
sleep time: 30, unit: 'SECONDS'
|
||||
sh 'docker ps | grep internalgateways'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,178 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Medallion.Threading;
|
||||
using Medallion.Threading.Redis;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using KonSoft.Admin.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using KonSoft.Admin.EntityFrameworkCore;
|
||||
using KonSoft.Admin.MultiTenancy;
|
||||
using StackExchange.Redis;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
|
||||
using Volo.Abp.AspNetCore.Mvc;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
|
||||
using Volo.Abp.AspNetCore.Serilog;
|
||||
using Volo.Abp.Autofac;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.Caching.StackExchangeRedis;
|
||||
using Volo.Abp.DistributedLocking;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.Localization;
|
||||
using Volo.Abp.AspNetCore.Mvc.Libs;
|
||||
using Volo.Abp.BackgroundJobs;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.Security.Claims;
|
||||
using Volo.Abp.Swashbuckle;
|
||||
using Volo.Abp.VirtualFileSystem;
|
||||
|
||||
namespace KonSoft.Admin;
|
||||
|
||||
[DependsOn(
|
||||
typeof(AdminHttpApiModule),
|
||||
typeof(AbpAutofacModule),
|
||||
typeof(AbpCachingStackExchangeRedisModule),
|
||||
typeof(AbpDistributedLockingModule),
|
||||
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
|
||||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
|
||||
typeof(AdminApplicationModule),
|
||||
typeof(AdminEntityFrameworkCoreModule),
|
||||
typeof(AbpAspNetCoreSerilogModule),
|
||||
typeof(AbpSwashbuckleModule)
|
||||
typeof(KonSoftSharedHostingMicroservicesModule)
|
||||
)]
|
||||
public class AdminHttpApiHostModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
ConfigureConventionalControllers();
|
||||
ConfigureAuthentication(context, configuration);
|
||||
ConfigureCache(configuration);
|
||||
ConfigureVirtualFileSystem(context);
|
||||
ConfigureDataProtection(context, configuration, hostingEnvironment);
|
||||
ConfigureDistributedLocking(context, configuration);
|
||||
ConfigureCors(context, configuration);
|
||||
ConfigureSwaggerServices(context, configuration);
|
||||
}
|
||||
|
||||
private void ConfigureCache(IConfiguration configuration)
|
||||
{
|
||||
Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "Admin:"; });
|
||||
}
|
||||
|
||||
private void ConfigureVirtualFileSystem(ServiceConfigurationContext context)
|
||||
{
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
if (hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
Configure<AbpVirtualFileSystemOptions>(options =>
|
||||
{
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<AdminDomainSharedModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Admin.Domain.Shared"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<AdminDomainModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Admin.Domain"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<AdminApplicationContractsModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Admin.Application.Contracts"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<AdminApplicationModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Admin.Application"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureConventionalControllers()
|
||||
{
|
||||
Configure<AbpAspNetCoreMvcOptions>(options =>
|
||||
{
|
||||
options.ConventionalControllers.Create(typeof(AdminApplicationModule).Assembly);
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddAbpJwtBearer(options =>
|
||||
{
|
||||
options.Authority = configuration["AuthServer:Authority"];
|
||||
options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");
|
||||
options.Audience = "Admin";
|
||||
});
|
||||
|
||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||
{
|
||||
options.IsDynamicClaimsEnabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAbpSwaggerGenWithOAuth(
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{"Admin", "Admin API"}
|
||||
},
|
||||
options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Admin API", Version = "v1" });
|
||||
options.DocInclusionPredicate((docName, description) => true);
|
||||
options.CustomSchemaIds(type => type.FullName);
|
||||
});
|
||||
}
|
||||
["Admin", "Dispatch", "Payment", "Report", "TenantManagement"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "Administration Service API"
|
||||
);
|
||||
|
||||
private void ConfigureDataProtection(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration,
|
||||
IWebHostEnvironment hostingEnvironment)
|
||||
{
|
||||
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("Admin");
|
||||
if (!hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "Admin-Protection-Keys");
|
||||
}
|
||||
}
|
||||
// ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
||||
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
|
||||
|
||||
private void ConfigureDistributedLocking(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
|
||||
Configure<AbpMvcLibsOptions>(options =>
|
||||
{
|
||||
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder
|
||||
.WithOrigins(configuration["App:CorsOrigins"]?
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(o => o.RemovePostFix("/"))
|
||||
.ToArray() ?? [])
|
||||
.WithAbpExposedHeaders()
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials();
|
||||
});
|
||||
options.CheckLibs = false;
|
||||
});
|
||||
}
|
||||
|
||||
@ -193,7 +57,7 @@ public class AdminHttpApiHostModule : AbpModule
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
||||
if (MultiTenancyConsts.IsEnabled)
|
||||
if (KonSoftConsts.MultiTenancyEnabled)
|
||||
{
|
||||
app.UseMultiTenancy();
|
||||
}
|
||||
@ -211,9 +75,15 @@ public class AdminHttpApiHostModule : AbpModule
|
||||
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
|
||||
options.OAuthScopes("Admin");
|
||||
});
|
||||
|
||||
|
||||
app.UseAuditing();
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
|
||||
//public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context)
|
||||
//{
|
||||
// await context.ServiceProvider.GetRequiredService<AdminPendingEfCoreMigrationsChecker>()
|
||||
// .CheckAndApplyDatabaseMigrationsAsync();
|
||||
//}
|
||||
}
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Data;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace KonSoft.Admin.DbMigrations;
|
||||
|
||||
public class AdminDataSeedContributor : IDataSeedContributor, ITransientDependency
|
||||
{
|
||||
public Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using KonSoft.Admin.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.Microservices.DbMigrations.EfCore;
|
||||
using Volo.Abp.DistributedLocking;
|
||||
using Volo.Abp.EventBus.Distributed;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
using Volo.Abp.Uow;
|
||||
|
||||
namespace KonSoft.Admin.DbMigrations;
|
||||
|
||||
public class AdminPendingEfCoreMigrationsChecker : PendingEfCoreMigrationsChecker<AdminDbContext>
|
||||
{
|
||||
public AdminPendingEfCoreMigrationsChecker(IUnitOfWorkManager unitOfWorkManager,
|
||||
IServiceProvider serviceProvider,
|
||||
ICurrentTenant currentTenant,
|
||||
IDistributedEventBus distributedEventBus,
|
||||
IAbpDistributedLock abpDistributedLock) : base(unitOfWorkManager,
|
||||
serviceProvider,
|
||||
currentTenant,
|
||||
distributedEventBus,
|
||||
abpDistributedLock,
|
||||
"Clean")
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
@ -15,6 +15,10 @@ COPY ["modules/admin/src/KonSoft.Admin.Domain.Shared/KonSoft.Admin.Domain.Shared
|
||||
COPY ["modules/admin/src/KonSoft.Admin.Application.Contracts/KonSoft.Admin.Application.Contracts.csproj", "modules/admin/src/KonSoft.Admin.Application.Contracts/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.EntityFrameworkCore/KonSoft.Admin.EntityFrameworkCore.csproj", "modules/admin/src/KonSoft.Admin.EntityFrameworkCore/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.HttpApi/KonSoft.Admin.HttpApi.csproj", "modules/admin/src/KonSoft.Admin.HttpApi/"]
|
||||
COPY ["shared/KonSoft.Shared.Hosting.Microservices/KonSoft.Shared.Hosting.Microservices.csproj", "shared/KonSoft.Shared.Hosting.Microservices/"]
|
||||
COPY ["shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj", "shared/KonSoft.Shared.Hosting.AspNetCore/"]
|
||||
COPY ["shared/KonSoft.Shared.Hosting/KonSoft.Shared.Hosting.csproj", "shared/KonSoft.Shared.Hosting/"]
|
||||
COPY ["shared/KonSoft.Shared.Localization/KonSoft.Shared.Localization.csproj", "shared/KonSoft.Shared.Localization/"]
|
||||
RUN dotnet restore "./microservices/KonSoft.Admin.HttpApi.Host/KonSoft.Admin.HttpApi.Host.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/microservices/KonSoft.Admin.HttpApi.Host"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
@ -10,22 +10,6 @@
|
||||
<DockerfileContext>..\..</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.4" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.2" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.DistributedLocking" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Logs\**" />
|
||||
<Content Remove="Logs\**" />
|
||||
@ -33,10 +17,15 @@
|
||||
<None Remove="Logs\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj" />
|
||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.EntityFrameworkCore\KonSoft.Admin.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.HttpApi\KonSoft.Admin.HttpApi.csproj" />
|
||||
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
1165
microservices/KonSoft.Admin.HttpApi.Host/Logs/logs.txt
Normal file
1165
microservices/KonSoft.Admin.HttpApi.Host/Logs/logs.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,56 +1,29 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
|
||||
namespace KonSoft.Admin;
|
||||
var assemblyName = typeof(Program).Assembly.GetName().Name!;
|
||||
|
||||
public class Program
|
||||
SerilogConfigurationHelper.Configure(assemblyName);
|
||||
try
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
.MinimumLevel.Debug()
|
||||
#else
|
||||
.MinimumLevel.Information()
|
||||
#endif
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
||||
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.Async(c => c.File("Logs/logs.txt"))
|
||||
.WriteTo.Async(c => c.Console())
|
||||
.CreateLogger();
|
||||
Log.Information($"Starting {assemblyName}.");
|
||||
var app = await ApplicationBuilderHelper
|
||||
.BuildApplicationAsync<AdminHttpApiHostModule>(args);
|
||||
await app.InitializeApplicationAsync();
|
||||
app.MapGet("/heath", () => "Online");
|
||||
await app.RunAsync();
|
||||
|
||||
try
|
||||
{
|
||||
Log.Information("Starting KonSoft.Admin.HttpApi.Host.");
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Host.AddAppSettingsSecretsJson()
|
||||
.UseAutofac()
|
||||
.UseSerilog();
|
||||
await builder.AddApplicationAsync<AdminHttpApiHostModule>();
|
||||
var app = builder.Build();
|
||||
await app.InitializeApplicationAsync();
|
||||
await app.RunAsync();
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is HostAbortedException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
Log.Fatal(ex, "Host terminated unexpectedly!");
|
||||
return 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!");
|
||||
return 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Log.CloseAndFlushAsync();
|
||||
}
|
||||
@ -1,38 +1,13 @@
|
||||
{
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"KonSoft.Admin.HttpApi.Host": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:44354"
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_HTTPS_PORTS": "8081",
|
||||
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
"applicationUrl": "http://localhost:44354"
|
||||
}
|
||||
},
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44354",
|
||||
"sslPort": 44354
|
||||
}
|
||||
}
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json"
|
||||
}
|
||||
@ -1,19 +1,14 @@
|
||||
{
|
||||
"App": {
|
||||
"CorsOrigins": "https://*.Admin.com,https://localhost:44357"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Default": "Host=localhost;Port=5432;Database=Admin;User ID=root;Password=myPassword;"
|
||||
},
|
||||
"Redis": {
|
||||
"Configuration": "127.0.0.1"
|
||||
"AgileConfig": {
|
||||
"appId": "KonSoft.Admin.HttpApi.Host",
|
||||
"name": "KonSoft.Admin.HttpApi.Host",
|
||||
"nodes": "https://config.konsoft.top/",
|
||||
"secret": "DBE31703-14F9-4B01-893D-900B8380CE04"
|
||||
},
|
||||
"AuthServer": {
|
||||
"Authority": "https://localhost:44397",
|
||||
"RequireHttpsMetadata": true,
|
||||
"SwaggerClientId": "Admin_Swagger"
|
||||
},
|
||||
"StringEncryption": {
|
||||
"DefaultPassPhrase": "g3NdNOyDR9oYj0gK"
|
||||
"Authority": "https://devauth.konsoft.top",
|
||||
"RequireHttpsMetadata": false,
|
||||
"SwaggerClientId": "Dev_Admin_Swagger",
|
||||
"MetadataAddress": "https://devauth.konsoft.top"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Admin.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Admin.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,179 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Medallion.Threading;
|
||||
using Medallion.Threading.Redis;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using KonSoft.Dispatch.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using KonSoft.Dispatch.EntityFrameworkCore;
|
||||
using KonSoft.Dispatch.MultiTenancy;
|
||||
using StackExchange.Redis;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
|
||||
using Volo.Abp.AspNetCore.Mvc;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
|
||||
using Volo.Abp.AspNetCore.Serilog;
|
||||
using Volo.Abp.Autofac;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.Caching.StackExchangeRedis;
|
||||
using Volo.Abp.DistributedLocking;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.Localization;
|
||||
using Volo.Abp.BackgroundJobs;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.Security.Claims;
|
||||
using Volo.Abp.Swashbuckle;
|
||||
using Volo.Abp.VirtualFileSystem;
|
||||
|
||||
namespace KonSoft.Dispatch;
|
||||
|
||||
[DependsOn(
|
||||
typeof(DispatchHttpApiModule),
|
||||
typeof(AbpAutofacModule),
|
||||
typeof(AbpCachingStackExchangeRedisModule),
|
||||
typeof(AbpDistributedLockingModule),
|
||||
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
|
||||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
|
||||
typeof(DispatchApplicationModule),
|
||||
typeof(DispatchEntityFrameworkCoreModule),
|
||||
typeof(AbpAspNetCoreSerilogModule),
|
||||
typeof(AbpSwashbuckleModule)
|
||||
typeof(KonSoftSharedHostingMicroservicesModule)
|
||||
)]
|
||||
public class DispatchHttpApiHostModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
ConfigureConventionalControllers();
|
||||
ConfigureAuthentication(context, configuration);
|
||||
ConfigureCache(configuration);
|
||||
ConfigureVirtualFileSystem(context);
|
||||
ConfigureDataProtection(context, configuration, hostingEnvironment);
|
||||
ConfigureDistributedLocking(context, configuration);
|
||||
ConfigureCors(context, configuration);
|
||||
ConfigureSwaggerServices(context, configuration);
|
||||
}
|
||||
|
||||
private void ConfigureCache(IConfiguration configuration)
|
||||
{
|
||||
Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "Dispatch:"; });
|
||||
}
|
||||
|
||||
private void ConfigureVirtualFileSystem(ServiceConfigurationContext context)
|
||||
{
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
if (hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
Configure<AbpVirtualFileSystemOptions>(options =>
|
||||
{
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<DispatchDomainSharedModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Dispatch.Domain.Shared"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<DispatchDomainModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Dispatch.Domain"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<DispatchApplicationContractsModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Dispatch.Application.Contracts"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<DispatchApplicationModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Dispatch.Application"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureConventionalControllers()
|
||||
{
|
||||
Configure<AbpAspNetCoreMvcOptions>(options =>
|
||||
{
|
||||
options.ConventionalControllers.Create(typeof(DispatchApplicationModule).Assembly);
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddAbpJwtBearer(options =>
|
||||
{
|
||||
options.Authority = configuration["AuthServer:Authority"];
|
||||
options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");
|
||||
options.Audience = "Dispatch";
|
||||
});
|
||||
|
||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||
{
|
||||
options.IsDynamicClaimsEnabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAbpSwaggerGenWithOAuth(
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{"Dispatch", "Dispatch API"}
|
||||
},
|
||||
options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Dispatch API", Version = "v1" });
|
||||
options.DocInclusionPredicate((docName, description) => true);
|
||||
options.CustomSchemaIds(type => type.FullName);
|
||||
});
|
||||
}
|
||||
["DispatchService"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "Dispatch Service API"
|
||||
);
|
||||
|
||||
private void ConfigureDataProtection(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration,
|
||||
IWebHostEnvironment hostingEnvironment)
|
||||
{
|
||||
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("Dispatch");
|
||||
if (!hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "Dispatch-Protection-Keys");
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureDistributedLocking(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
|
||||
{
|
||||
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder
|
||||
.WithOrigins(configuration["App:CorsOrigins"]?
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(o => o.RemovePostFix("/"))
|
||||
.ToArray() ?? [])
|
||||
.WithAbpExposedHeaders()
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials();
|
||||
});
|
||||
});
|
||||
// ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
||||
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
|
||||
}
|
||||
|
||||
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||
@ -193,7 +51,7 @@ public class DispatchHttpApiHostModule : AbpModule
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
||||
if (MultiTenancyConsts.IsEnabled)
|
||||
if (KonSoftConsts.MultiTenancyEnabled)
|
||||
{
|
||||
app.UseMultiTenancy();
|
||||
}
|
||||
@ -216,4 +74,4 @@ public class DispatchHttpApiHostModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
@ -8,21 +8,6 @@
|
||||
<UserSecretsId>KonSoft.Dispatch-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.4" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.2" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.DistributedLocking" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Logs\**" />
|
||||
<Content Remove="Logs\**" />
|
||||
@ -34,6 +19,7 @@
|
||||
<ProjectReference Include="..\..\modules\dispatch\src\KonSoft.Dispatch.Application\KonSoft.Dispatch.Application.csproj" />
|
||||
<ProjectReference Include="..\..\modules\dispatch\src\KonSoft.Dispatch.EntityFrameworkCore\KonSoft.Dispatch.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\..\modules\dispatch\src\KonSoft.Dispatch.HttpApi\KonSoft.Dispatch.HttpApi.csproj" />
|
||||
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -10,7 +10,7 @@ namespace KonSoft.Dispatch;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
@ -53,4 +53,4 @@ public class Program
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,13 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44331",
|
||||
"sslPort": 44331
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"KonSoft.Dispatch.HttpApi.Host": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:44331",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"applicationUrl": "https://localhost:44331"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Dispatch.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Dispatch.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,21 +8,6 @@
|
||||
<UserSecretsId>KonSoft.Payment-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.4" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.2" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.DistributedLocking" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Logs\**" />
|
||||
<Content Remove="Logs\**" />
|
||||
@ -34,6 +19,7 @@
|
||||
<ProjectReference Include="..\..\modules\payment\src\KonSoft.Payment.Application\KonSoft.Payment.Application.csproj" />
|
||||
<ProjectReference Include="..\..\modules\payment\src\KonSoft.Payment.EntityFrameworkCore\KonSoft.Payment.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\..\modules\payment\src\KonSoft.Payment.HttpApi\KonSoft.Payment.HttpApi.csproj" />
|
||||
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,179 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Medallion.Threading;
|
||||
using Medallion.Threading.Redis;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using KonSoft.Payment.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using KonSoft.Payment.EntityFrameworkCore;
|
||||
using KonSoft.Payment.MultiTenancy;
|
||||
using StackExchange.Redis;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
|
||||
using Volo.Abp.AspNetCore.Mvc;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
|
||||
using Volo.Abp.AspNetCore.Serilog;
|
||||
using Volo.Abp.Autofac;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.Caching.StackExchangeRedis;
|
||||
using Volo.Abp.DistributedLocking;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.Localization;
|
||||
using Volo.Abp.BackgroundJobs;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.Security.Claims;
|
||||
using Volo.Abp.Swashbuckle;
|
||||
using Volo.Abp.VirtualFileSystem;
|
||||
|
||||
namespace KonSoft.Payment;
|
||||
|
||||
[DependsOn(
|
||||
typeof(PaymentHttpApiModule),
|
||||
typeof(AbpAutofacModule),
|
||||
typeof(AbpCachingStackExchangeRedisModule),
|
||||
typeof(AbpDistributedLockingModule),
|
||||
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
|
||||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
|
||||
typeof(PaymentApplicationModule),
|
||||
typeof(PaymentEntityFrameworkCoreModule),
|
||||
typeof(AbpAspNetCoreSerilogModule),
|
||||
typeof(AbpSwashbuckleModule)
|
||||
typeof(KonSoftSharedHostingMicroservicesModule)
|
||||
)]
|
||||
public class PaymentHttpApiHostModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
ConfigureConventionalControllers();
|
||||
ConfigureAuthentication(context, configuration);
|
||||
ConfigureCache(configuration);
|
||||
ConfigureVirtualFileSystem(context);
|
||||
ConfigureDataProtection(context, configuration, hostingEnvironment);
|
||||
ConfigureDistributedLocking(context, configuration);
|
||||
ConfigureCors(context, configuration);
|
||||
ConfigureSwaggerServices(context, configuration);
|
||||
}
|
||||
|
||||
private void ConfigureCache(IConfiguration configuration)
|
||||
{
|
||||
Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "Payment:"; });
|
||||
}
|
||||
|
||||
private void ConfigureVirtualFileSystem(ServiceConfigurationContext context)
|
||||
{
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
if (hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
Configure<AbpVirtualFileSystemOptions>(options =>
|
||||
{
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<PaymentDomainSharedModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Payment.Domain.Shared"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<PaymentDomainModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Payment.Domain"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<PaymentApplicationContractsModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Payment.Application.Contracts"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<PaymentApplicationModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Payment.Application"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureConventionalControllers()
|
||||
{
|
||||
Configure<AbpAspNetCoreMvcOptions>(options =>
|
||||
{
|
||||
options.ConventionalControllers.Create(typeof(PaymentApplicationModule).Assembly);
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddAbpJwtBearer(options =>
|
||||
{
|
||||
options.Authority = configuration["AuthServer:Authority"];
|
||||
options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");
|
||||
options.Audience = "Payment";
|
||||
});
|
||||
|
||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||
{
|
||||
options.IsDynamicClaimsEnabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAbpSwaggerGenWithOAuth(
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{"Payment", "Payment API"}
|
||||
},
|
||||
options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Payment API", Version = "v1" });
|
||||
options.DocInclusionPredicate((docName, description) => true);
|
||||
options.CustomSchemaIds(type => type.FullName);
|
||||
});
|
||||
}
|
||||
["PaymentService"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "Payment Service API"
|
||||
);
|
||||
|
||||
private void ConfigureDataProtection(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration,
|
||||
IWebHostEnvironment hostingEnvironment)
|
||||
{
|
||||
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("Payment");
|
||||
if (!hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "Payment-Protection-Keys");
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureDistributedLocking(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
|
||||
{
|
||||
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder
|
||||
.WithOrigins(configuration["App:CorsOrigins"]?
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(o => o.RemovePostFix("/"))
|
||||
.ToArray() ?? [])
|
||||
.WithAbpExposedHeaders()
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials();
|
||||
});
|
||||
});
|
||||
// ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
||||
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
|
||||
}
|
||||
|
||||
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||
@ -193,7 +51,7 @@ public class PaymentHttpApiHostModule : AbpModule
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
||||
if (MultiTenancyConsts.IsEnabled)
|
||||
if (KonSoftConsts.MultiTenancyEnabled)
|
||||
{
|
||||
app.UseMultiTenancy();
|
||||
}
|
||||
@ -216,4 +74,4 @@ public class PaymentHttpApiHostModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace KonSoft.Payment;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
@ -53,4 +53,4 @@ public class Program
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,13 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44326",
|
||||
"sslPort": 44326
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"KonSoft.Payment.HttpApi.Host": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:44326",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"applicationUrl": "https://localhost:44326"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Payment.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Payment.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,21 +8,6 @@
|
||||
<UserSecretsId>KonSoft.Report-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.4" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.2" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.DistributedLocking" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Logs\**" />
|
||||
<Content Remove="Logs\**" />
|
||||
@ -34,6 +19,7 @@
|
||||
<ProjectReference Include="..\..\modules\report\src\KonSoft.Report.Application\KonSoft.Report.Application.csproj" />
|
||||
<ProjectReference Include="..\..\modules\report\src\KonSoft.Report.EntityFrameworkCore\KonSoft.Report.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\..\modules\report\src\KonSoft.Report.HttpApi\KonSoft.Report.HttpApi.csproj" />
|
||||
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -10,7 +10,7 @@ namespace KonSoft.Report;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
@ -53,4 +53,4 @@ public class Program
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,13 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44320",
|
||||
"sslPort": 44320
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"KonSoft.Report.HttpApi.Host": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:44320",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"applicationUrl": "https://localhost:44320"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,179 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Medallion.Threading;
|
||||
using Medallion.Threading.Redis;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using KonSoft.Report.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using KonSoft.Report.EntityFrameworkCore;
|
||||
using KonSoft.Report.MultiTenancy;
|
||||
using StackExchange.Redis;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
|
||||
using Volo.Abp.AspNetCore.Mvc;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
|
||||
using Volo.Abp.AspNetCore.Serilog;
|
||||
using Volo.Abp.Autofac;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.Caching.StackExchangeRedis;
|
||||
using Volo.Abp.DistributedLocking;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.Localization;
|
||||
using Volo.Abp.BackgroundJobs;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.Security.Claims;
|
||||
using Volo.Abp.Swashbuckle;
|
||||
using Volo.Abp.VirtualFileSystem;
|
||||
|
||||
namespace KonSoft.Report;
|
||||
|
||||
[DependsOn(
|
||||
typeof(ReportHttpApiModule),
|
||||
typeof(AbpAutofacModule),
|
||||
typeof(AbpCachingStackExchangeRedisModule),
|
||||
typeof(AbpDistributedLockingModule),
|
||||
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
|
||||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
|
||||
typeof(ReportApplicationModule),
|
||||
typeof(ReportEntityFrameworkCoreModule),
|
||||
typeof(AbpAspNetCoreSerilogModule),
|
||||
typeof(AbpSwashbuckleModule)
|
||||
typeof(KonSoftSharedHostingMicroservicesModule)
|
||||
)]
|
||||
public class ReportHttpApiHostModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
ConfigureConventionalControllers();
|
||||
ConfigureAuthentication(context, configuration);
|
||||
ConfigureCache(configuration);
|
||||
ConfigureVirtualFileSystem(context);
|
||||
ConfigureDataProtection(context, configuration, hostingEnvironment);
|
||||
ConfigureDistributedLocking(context, configuration);
|
||||
ConfigureCors(context, configuration);
|
||||
ConfigureSwaggerServices(context, configuration);
|
||||
}
|
||||
|
||||
private void ConfigureCache(IConfiguration configuration)
|
||||
{
|
||||
Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "Report:"; });
|
||||
}
|
||||
|
||||
private void ConfigureVirtualFileSystem(ServiceConfigurationContext context)
|
||||
{
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
if (hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
Configure<AbpVirtualFileSystemOptions>(options =>
|
||||
{
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<ReportDomainSharedModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Report.Domain.Shared"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<ReportDomainModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Report.Domain"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<ReportApplicationContractsModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Report.Application.Contracts"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<ReportApplicationModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.Report.Application"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureConventionalControllers()
|
||||
{
|
||||
Configure<AbpAspNetCoreMvcOptions>(options =>
|
||||
{
|
||||
options.ConventionalControllers.Create(typeof(ReportApplicationModule).Assembly);
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddAbpJwtBearer(options =>
|
||||
{
|
||||
options.Authority = configuration["AuthServer:Authority"];
|
||||
options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");
|
||||
options.Audience = "Report";
|
||||
});
|
||||
|
||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||
{
|
||||
options.IsDynamicClaimsEnabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAbpSwaggerGenWithOAuth(
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{"Report", "Report API"}
|
||||
},
|
||||
options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Report API", Version = "v1" });
|
||||
options.DocInclusionPredicate((docName, description) => true);
|
||||
options.CustomSchemaIds(type => type.FullName);
|
||||
});
|
||||
}
|
||||
["ReportService"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "Report Service API"
|
||||
);
|
||||
|
||||
private void ConfigureDataProtection(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration,
|
||||
IWebHostEnvironment hostingEnvironment)
|
||||
{
|
||||
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("Report");
|
||||
if (!hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "Report-Protection-Keys");
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureDistributedLocking(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
|
||||
{
|
||||
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder
|
||||
.WithOrigins(configuration["App:CorsOrigins"]?
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(o => o.RemovePostFix("/"))
|
||||
.ToArray() ?? [])
|
||||
.WithAbpExposedHeaders()
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials();
|
||||
});
|
||||
});
|
||||
// ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
||||
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
|
||||
}
|
||||
|
||||
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||
@ -193,7 +51,7 @@ public class ReportHttpApiHostModule : AbpModule
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
||||
if (MultiTenancyConsts.IsEnabled)
|
||||
if (KonSoftConsts.MultiTenancyEnabled)
|
||||
{
|
||||
app.UseMultiTenancy();
|
||||
}
|
||||
@ -216,4 +74,4 @@ public class ReportHttpApiHostModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Report.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Report.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,21 +8,6 @@
|
||||
<UserSecretsId>KonSoft.TenantManagement-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.4" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.2" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.DistributedLocking" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Logs\**" />
|
||||
<Content Remove="Logs\**" />
|
||||
@ -34,6 +19,7 @@
|
||||
<ProjectReference Include="..\..\modules\tenant-management\src\KonSoft.TenantManagement.Application\KonSoft.TenantManagement.Application.csproj" />
|
||||
<ProjectReference Include="..\..\modules\tenant-management\src\KonSoft.TenantManagement.EntityFrameworkCore\KonSoft.TenantManagement.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\..\modules\tenant-management\src\KonSoft.TenantManagement.HttpApi\KonSoft.TenantManagement.HttpApi.csproj" />
|
||||
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -10,7 +10,7 @@ namespace KonSoft.TenantManagement;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
@ -53,4 +53,4 @@ public class Program
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,13 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44348",
|
||||
"sslPort": 44348
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"KonSoft.TenantManagement.HttpApi.Host": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:44348",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"applicationUrl": "https://localhost:44348"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,179 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Medallion.Threading;
|
||||
using Medallion.Threading.Redis;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using KonSoft.TenantManagement.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using KonSoft.TenantManagement.EntityFrameworkCore;
|
||||
using KonSoft.TenantManagement.MultiTenancy;
|
||||
using StackExchange.Redis;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
|
||||
using Volo.Abp.AspNetCore.Mvc;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
|
||||
using Volo.Abp.AspNetCore.Serilog;
|
||||
using Volo.Abp.Autofac;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.Caching.StackExchangeRedis;
|
||||
using Volo.Abp.DistributedLocking;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.Localization;
|
||||
using Volo.Abp.BackgroundJobs;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.Security.Claims;
|
||||
using Volo.Abp.Swashbuckle;
|
||||
using Volo.Abp.VirtualFileSystem;
|
||||
|
||||
namespace KonSoft.TenantManagement;
|
||||
|
||||
[DependsOn(
|
||||
typeof(TenantManagementHttpApiModule),
|
||||
typeof(AbpAutofacModule),
|
||||
typeof(AbpCachingStackExchangeRedisModule),
|
||||
typeof(AbpDistributedLockingModule),
|
||||
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
|
||||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
|
||||
typeof(TenantManagementApplicationModule),
|
||||
typeof(TenantManagementEntityFrameworkCoreModule),
|
||||
typeof(AbpAspNetCoreSerilogModule),
|
||||
typeof(AbpSwashbuckleModule)
|
||||
typeof(KonSoftSharedHostingMicroservicesModule)
|
||||
)]
|
||||
public class TenantManagementHttpApiHostModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
ConfigureConventionalControllers();
|
||||
ConfigureAuthentication(context, configuration);
|
||||
ConfigureCache(configuration);
|
||||
ConfigureVirtualFileSystem(context);
|
||||
ConfigureDataProtection(context, configuration, hostingEnvironment);
|
||||
ConfigureDistributedLocking(context, configuration);
|
||||
ConfigureCors(context, configuration);
|
||||
ConfigureSwaggerServices(context, configuration);
|
||||
}
|
||||
|
||||
private void ConfigureCache(IConfiguration configuration)
|
||||
{
|
||||
Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "TenantManagement:"; });
|
||||
}
|
||||
|
||||
private void ConfigureVirtualFileSystem(ServiceConfigurationContext context)
|
||||
{
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment();
|
||||
|
||||
if (hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
Configure<AbpVirtualFileSystemOptions>(options =>
|
||||
{
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<TenantManagementDomainSharedModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.TenantManagement.Domain.Shared"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<TenantManagementDomainModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.TenantManagement.Domain"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<TenantManagementApplicationContractsModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.TenantManagement.Application.Contracts"));
|
||||
options.FileSets.ReplaceEmbeddedByPhysical<TenantManagementApplicationModule>(
|
||||
Path.Combine(hostingEnvironment.ContentRootPath,
|
||||
$"..{Path.DirectorySeparatorChar}KonSoft.TenantManagement.Application"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureConventionalControllers()
|
||||
{
|
||||
Configure<AbpAspNetCoreMvcOptions>(options =>
|
||||
{
|
||||
options.ConventionalControllers.Create(typeof(TenantManagementApplicationModule).Assembly);
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddAbpJwtBearer(options =>
|
||||
{
|
||||
options.Authority = configuration["AuthServer:Authority"];
|
||||
options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");
|
||||
options.Audience = "TenantManagement";
|
||||
});
|
||||
|
||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||
{
|
||||
options.IsDynamicClaimsEnabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddAbpSwaggerGenWithOAuth(
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{"TenantManagement", "TenantManagement API"}
|
||||
},
|
||||
options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo { Title = "TenantManagement API", Version = "v1" });
|
||||
options.DocInclusionPredicate((docName, description) => true);
|
||||
options.CustomSchemaIds(type => type.FullName);
|
||||
});
|
||||
}
|
||||
["TenantManagementService"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "TenantManagement Service API"
|
||||
);
|
||||
|
||||
private void ConfigureDataProtection(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration,
|
||||
IWebHostEnvironment hostingEnvironment)
|
||||
{
|
||||
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("TenantManagement");
|
||||
if (!hostingEnvironment.IsDevelopment())
|
||||
{
|
||||
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "TenantManagement-Protection-Keys");
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureDistributedLocking(
|
||||
ServiceConfigurationContext context,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
|
||||
{
|
||||
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
|
||||
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
|
||||
});
|
||||
}
|
||||
|
||||
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
|
||||
{
|
||||
context.Services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder
|
||||
.WithOrigins(configuration["App:CorsOrigins"]?
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(o => o.RemovePostFix("/"))
|
||||
.ToArray() ?? [])
|
||||
.WithAbpExposedHeaders()
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials();
|
||||
});
|
||||
});
|
||||
// ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
||||
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
|
||||
}
|
||||
|
||||
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||
@ -193,7 +51,7 @@ public class TenantManagementHttpApiHostModule : AbpModule
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
||||
if (MultiTenancyConsts.IsEnabled)
|
||||
if (KonSoftConsts.MultiTenancyEnabled)
|
||||
{
|
||||
app.UseMultiTenancy();
|
||||
}
|
||||
@ -216,4 +74,4 @@ public class TenantManagementHttpApiHostModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.TenantManagement.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.TenantManagement.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -25,4 +25,4 @@ public class AdminApplicationContractsModule : AbpModule
|
||||
{
|
||||
AdminDtoExtensions.Configure();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,28 +1,26 @@
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.ObjectExtending;
|
||||
using Volo.Abp.Threading;
|
||||
using Volo.Abp.Threading;
|
||||
|
||||
namespace KonSoft.Admin;
|
||||
|
||||
public static class AdminDtoExtensions
|
||||
{
|
||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
||||
private static readonly OneTimeRunner OneTimeRunner = new();
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
OneTimeRunner.Run(() =>
|
||||
{
|
||||
/* You can add extension properties to DTOs
|
||||
* defined in the depended modules.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ObjectExtensionManager.Instance
|
||||
* .AddOrUpdateProperty<IdentityRoleDto, string>("Title");
|
||||
*
|
||||
* See the documentation for more:
|
||||
* https://docs.abp.io/en/abp/latest/Object-Extensions
|
||||
*/
|
||||
/* You can add extension properties to DTOs
|
||||
* defined in the depended modules.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ObjectExtensionManager.Instance
|
||||
* .AddOrUpdateProperty<IdentityRoleDto, string>("Title");
|
||||
*
|
||||
* See the documentation for more:
|
||||
* https://docs.abp.io/en/abp/latest/Object-Extensions
|
||||
*/
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class AddressDto
|
||||
{
|
||||
public string ContactName { get; set; }
|
||||
public string ContactPhone { get; set; }
|
||||
public string DetailAddress { get; set; }
|
||||
public string City { get; set; }
|
||||
public string District { get; set; }
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class CreateOrderDto
|
||||
{
|
||||
[Required] public Guid CustomerId { get; set; }
|
||||
|
||||
[Required] public Guid ServiceCategoryId { get; set; }
|
||||
|
||||
[Required] public DateTime ServiceTime { get; set; }
|
||||
|
||||
[Required] public decimal Amount { get; set; }
|
||||
|
||||
[Required] public AddressDto Address { get; set; }
|
||||
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class CreateServiceCategoryDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using KonSoft.Admin.Enums;
|
||||
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class OrderDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string OrderSN { get; set; }
|
||||
public Guid CustomerId { get; set; }
|
||||
public Guid? WorkerId { get; set; }
|
||||
public ServiceCategoryDto? ServiceCategory { get; set; }
|
||||
public DateTime ServiceTime { get; set; }
|
||||
public OrderStatus Status { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public decimal PaidAmount { get; set; }
|
||||
public string PaymentMethod { get; set; }
|
||||
public AddressDto Address { get; set; }
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
using KonSoft.Admin.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
{
|
||||
public class OrderPagedResultRequestDto : PagedResultRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单状态
|
||||
/// </summary>
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Created;
|
||||
|
||||
/// <summary>
|
||||
/// 服务时间
|
||||
/// </summary>
|
||||
public DateTime? ServiceTime { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class PayOrderDto
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class ProductDto : CreateProductDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 嵌套子类
|
||||
/// </summary>
|
||||
public List<CreateProductDto> Children { get; set; } = new();
|
||||
}
|
||||
|
||||
public class CreateProductDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 分类名称
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品编码
|
||||
/// </summary>
|
||||
public string Code { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品价格
|
||||
/// </summary>
|
||||
public decimal Price { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品描述
|
||||
/// </summary>
|
||||
public string Description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类类型(大类或小类)
|
||||
/// </summary>
|
||||
public string Type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父分类ID
|
||||
/// </summary>
|
||||
public Guid? ParentId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品状态(在售/下架等)
|
||||
/// </summary>
|
||||
public string Status { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
public int Order { get; private set; }
|
||||
}
|
||||
|
||||
public class UpdateProductDto : CreateProductDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class ServiceCategoryDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
public int Level { get; set; }
|
||||
public List<ServiceCategoryDto> Children { get; set; } = new();
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class WorkerDto : EntityDto<Guid>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public List<Guid> SkillCategoryIds { get; set; } = new(); // 擅长服务类型
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
{
|
||||
public class WorkerRegisterDto
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
using KonSoft.Admin.Dtos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
public interface IHouseholdWorkerAppService : IApplicationService
|
||||
{
|
||||
/// <summary>
|
||||
/// 家政人员注册
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task RegisterAsync(WorkerRegisterDto input);
|
||||
|
||||
/// <summary>
|
||||
/// 家政人员接单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
Task AcceptOrderAsync(Guid orderId);
|
||||
|
||||
/// <summary>
|
||||
/// 家政人员退单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
Task RejectOrderAsync(Guid orderId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 已到达(开始服务)
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
Task StartServiceAsync(Guid orderId);
|
||||
|
||||
/// <summary>
|
||||
/// 完成服务
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
Task CompleteServiceAsync(Guid orderId);
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前分配给家政人员的订单列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<OrderDto>> GetAssignedOrdersAsync(OrderPagedResultRequestDto requestDto);
|
||||
|
||||
/// <summary>
|
||||
/// 获取待接单订单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<OrderDto>> GetCreatedOrdersAsync(OrderPagedResultRequestDto requestDto);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
public interface IOrderAppService : IApplicationService
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建订单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<OrderDto> CreateAsync(CreateOrderDto input);
|
||||
|
||||
/// <summary>
|
||||
/// 支付上门费
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task PayServiceCallFeeAsync(Guid orderId, PayOrderDto input);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task PayAsync(Guid orderId, PayOrderDto input);
|
||||
|
||||
/// <summary>
|
||||
/// 取消订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="reason"></param>
|
||||
/// <returns></returns>
|
||||
Task CancelAsync(Guid orderId, string reason);
|
||||
Task DeleteAsync(params Guid[] ids);
|
||||
/// <summary>
|
||||
/// 修改订单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task EditAsync(OrderDto input);
|
||||
Task<OrderDto> GetAsync(Guid id);
|
||||
Task<PagedResultDto<OrderDto>> GetListAsync(OrderPagedResultRequestDto input);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
public interface IProductAppService : IApplicationService
|
||||
{
|
||||
Task CreateAsync(CreateProductDto input);
|
||||
Task UpdateAsync(UpdateProductDto input);
|
||||
Task DeleteAsync(Guid id);
|
||||
Task<ProductDto> GetAsync(Guid id);
|
||||
Task<PagedResultDto<ProductDto>> GetListAsync(PagedResultRequestDto input);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
public interface IServiceCategoryAppService
|
||||
{
|
||||
Task<ServiceCategoryDto> CreateAsync(CreateServiceCategoryDto input);
|
||||
Task DeleteAsync(Guid id);
|
||||
Task<List<ServiceCategoryDto>> GetTreeAsync();
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
public interface IWorkerAssignmentService
|
||||
{
|
||||
}
|
||||
@ -17,4 +17,4 @@ public class AdminPermissionDefinitionProvider : PermissionDefinitionProvider
|
||||
{
|
||||
return LocalizableString.Create<AdminResource>(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,4 +6,4 @@ public static class AdminPermissions
|
||||
|
||||
//Add your own permission names. Example:
|
||||
//public const string MyPermission1 = GroupName + ".MyPermission1";
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using KonSoft.Admin.Localization;
|
||||
using KonSoft.Admin.Localization;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace KonSoft.Admin;
|
||||
@ -14,4 +11,4 @@ public abstract class AdminAppService : ApplicationService
|
||||
{
|
||||
LocalizationResource = typeof(AdminResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,7 @@
|
||||
using AutoMapper;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.ValueObjects;
|
||||
|
||||
namespace KonSoft.Admin;
|
||||
|
||||
@ -9,5 +12,10 @@ public class AdminApplicationAutoMapperProfile : Profile
|
||||
/* You can configure your AutoMapper mapping configuration here.
|
||||
* Alternatively, you can split your mapping configurations
|
||||
* into multiple profile classes for a better organization. */
|
||||
|
||||
CreateMap<Order, OrderDto>();
|
||||
//CreateMap<CreateOrderDto, Order>();
|
||||
CreateMap<AddressDto, AddressInfo>();
|
||||
CreateMap<ServiceCategoryDto, ServiceCategory>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,14 +18,11 @@ namespace KonSoft.Admin;
|
||||
typeof(AbpTenantManagementApplicationModule),
|
||||
typeof(AbpFeatureManagementApplicationModule),
|
||||
typeof(AbpSettingManagementApplicationModule)
|
||||
)]
|
||||
)]
|
||||
public class AdminApplicationModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
Configure<AbpAutoMapperOptions>(options =>
|
||||
{
|
||||
options.AddMaps<AdminApplicationModule>();
|
||||
});
|
||||
Configure<AbpAutoMapperOptions>(options => { options.AddMaps<AdminApplicationModule>(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using KonSoft.Admin.IRepositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Volo.Abp.ObjectMapping;
|
||||
|
||||
namespace KonSoft.Admin.ApplicationServices
|
||||
{
|
||||
public class HouseholdWorkerAppService : ApplicationService, IHouseholdWorkerAppService
|
||||
{
|
||||
public IOrderRepository _orderRepository { get; set; }
|
||||
|
||||
public HouseholdWorkerAppService(IOrderRepository orderRepository)
|
||||
{
|
||||
_orderRepository = orderRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 家政人员接单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task AcceptOrderAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.FirstOrDefaultAsync(o => o.Id == orderId);
|
||||
if (order == null) throw new BusinessException("未找到订单");
|
||||
|
||||
order.AssignWorker(CurrentUser.Id!.Value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取已接单任务
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<List<OrderDto>> GetAssignedOrdersAsync(OrderPagedResultRequestDto requestDto)
|
||||
{
|
||||
//TODO 默认根据角色筛选对应订单,整合到一个接口中
|
||||
var query = await _orderRepository.GetQueryableAsync();
|
||||
var orders = query.Where(o => o.HouseholdWorkerId == CurrentUser.Id)
|
||||
.PageBy(requestDto).ToList(); ;
|
||||
|
||||
return ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取待接单任务
|
||||
/// </summary>
|
||||
/// <param name="requestDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<OrderDto>> GetCreatedOrdersAsync(OrderPagedResultRequestDto requestDto)
|
||||
{
|
||||
//TODO 默认根据角色筛选对应订单,整合到一个接口中
|
||||
var query = await _orderRepository.GetQueryableAsync();
|
||||
var orders = query.Where(o => o.Status == Enums.OrderStatus.Created)
|
||||
.PageBy(requestDto).ToList(); ;
|
||||
|
||||
return ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 家政人员注册
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public Task RegisterAsync(WorkerRegisterDto input)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
/// 退单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exasception cref="NotImplementedException"></exception>
|
||||
public async Task RejectOrderAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.FirstOrDefaultAsync(o => o.Id == orderId);
|
||||
if (order == null) throw new BusinessException("未找到订单");
|
||||
|
||||
order.RejectOrder(CurrentUser.Id!.Value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 开始服务
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task StartServiceAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.FirstOrDefaultAsync(o => o.Id == orderId);
|
||||
if (order == null) throw new BusinessException("未找到订单");
|
||||
|
||||
order.StartService();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 服务完成
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task CompleteServiceAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.FirstOrDefaultAsync(o => o.Id == orderId);
|
||||
if (order == null) throw new BusinessException("未找到订单");
|
||||
|
||||
order.CompleteService();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using KonSoft.Admin.IRepositories;
|
||||
using KonSoft.Admin.ValueObjects;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.ApplicationServices;
|
||||
|
||||
public class OrderAppService(IOrderRepository orderRepository) : ApplicationService, IOrderAppService
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository = orderRepository;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取消订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="reason"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task CancelAsync(Guid orderId, string reason)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.Cancel(reason);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建订单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<OrderDto> CreateAsync(CreateOrderDto input)
|
||||
{
|
||||
// 生成订单号 TODO
|
||||
var orderSN = "SN001";
|
||||
var address = ObjectMapper.Map<AddressDto, AddressInfo>(input.Address);
|
||||
var order = new Order(input.CustomerId, input.ServiceCategoryId, input.ServiceTime,
|
||||
input.Amount, address, input.Remark);
|
||||
|
||||
await _orderRepository.InsertAsync(order);
|
||||
return ObjectMapper.Map<Order, OrderDto>(order);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据订单ID删除订单
|
||||
/// </summary>
|
||||
/// <param name="id">订单ID</param>
|
||||
public async Task DeleteAsync(params Guid[] ids)
|
||||
{
|
||||
// 根据ID删除订单
|
||||
await _orderRepository.DeleteAsync(x => ids.Contains(x.Id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改订单信息
|
||||
/// </summary>
|
||||
/// <param name="input">订单DTO对象</param>
|
||||
public async Task EditAsync(OrderDto input)
|
||||
{
|
||||
// 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】
|
||||
var order = await _orderRepository.FindAsync(o => o.Id == input.Id) ??
|
||||
throw new BusinessException("订单找不到").WithData("Id", input.Id);
|
||||
|
||||
// 将输入的DTO字段映射到订单实体
|
||||
ObjectMapper.Map(input, order);
|
||||
|
||||
// 更新订单
|
||||
//await _orderRepository.UpdateAsync(order);
|
||||
}
|
||||
|
||||
public async Task PayServiceCallFeeAsync(Guid orderId, PayOrderDto input)
|
||||
{
|
||||
var order = await _orderRepository.FirstOrDefaultAsync(o => o.Id == orderId);
|
||||
if (order == null) throw new BusinessException("未找到订单");
|
||||
|
||||
order.PayServiceCallFee();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task PayAsync(Guid orderId, PayOrderDto input)
|
||||
{
|
||||
var order = await _orderRepository.FirstOrDefaultAsync(o => o.Id == orderId);
|
||||
if (order == null) throw new BusinessException("未找到订单");
|
||||
|
||||
order.Pay();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据订单ID获取单个订单
|
||||
/// </summary>
|
||||
public async Task<OrderDto> GetAsync(Guid id)
|
||||
{
|
||||
// 根据ID从数据库查询订单
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == id);
|
||||
|
||||
// 转换为OrderDto返回
|
||||
return ObjectMapper.Map<Order, OrderDto>(order);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取订单列表
|
||||
/// </summary>
|
||||
public async Task<PagedResultDto<OrderDto>> GetListAsync(OrderPagedResultRequestDto input)
|
||||
{
|
||||
//TODO 默认根据角色筛选对应订单,整合到一个接口中
|
||||
var query = await _orderRepository.GetQueryableAsync();
|
||||
var orders = query.PageBy(input).OrderBy(o => o.Id).ToList();
|
||||
|
||||
var totalCount = await _orderRepository.CountAsync();
|
||||
|
||||
var orderDtos = ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
|
||||
|
||||
return new PagedResultDto<OrderDto>(totalCount, orderDtos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using KonSoft.Admin.IRepositories;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.ApplicationServices;
|
||||
|
||||
public class ProductAppAppService(IProductRepository repository) : ApplicationService, IProductAppService
|
||||
{
|
||||
private readonly IProductRepository repository = repository;
|
||||
|
||||
/// <summary>
|
||||
/// 创建产品
|
||||
/// </summary>
|
||||
public async Task CreateAsync(CreateProductDto input)
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
var product = new Product(id, input.Name, input.Code, input.Price, input.Description, input.Type,
|
||||
input.ParentId, input.Status, input.Order);
|
||||
await repository.InsertAsync(product);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
await repository.DeleteAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
public async Task<ProductDto> GetAsync(Guid id)
|
||||
{
|
||||
var product = await repository.GetAsync(x => x.Id == id);
|
||||
return ObjectMapper.Map<Product, ProductDto>(product);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询集合
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PagedResultDto<ProductDto>> GetListAsync(PagedResultRequestDto input)
|
||||
{
|
||||
var query = await repository.GetPageRootListAsync(input.SkipCount, input.MaxResultCount,
|
||||
x => x.ParentId == null);
|
||||
var all = await repository.GetListAsync(x => x.ParentId != null);
|
||||
foreach (var item in query)
|
||||
{
|
||||
BuildChildren(item, all);
|
||||
}
|
||||
|
||||
var totalCount = await repository.CountAsync(x => x.ParentId == null);
|
||||
|
||||
var productDtos = ObjectMapper.Map<List<Product>, List<ProductDto>>(query);
|
||||
|
||||
return new PagedResultDto<ProductDto>(totalCount, productDtos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task UpdateAsync(UpdateProductDto input)
|
||||
{
|
||||
// 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】
|
||||
var order = await repository.FindAsync(o => o.Id == input.Id) ??
|
||||
throw new BusinessException("商品找不到").WithData("Id", input.Id);
|
||||
|
||||
// 将输入的DTO字段映射到订单实体
|
||||
ObjectMapper.Map(input, order);
|
||||
|
||||
// 更新订单
|
||||
await repository.UpdateAsync(order);
|
||||
}
|
||||
|
||||
private static void BuildChildren(Product parent, List<Product> all)
|
||||
{
|
||||
var children = all
|
||||
.Where(x => x.ParentId == parent.Id)
|
||||
.OrderBy(x => x.Order)
|
||||
.ToList();
|
||||
|
||||
parent.Children = children;
|
||||
|
||||
foreach (var child in children)
|
||||
{
|
||||
BuildChildren(child, all); // 递归
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user