diff --git a/.gitignore b/.gitignore index 1b2bff55b026b8c6f606c7f57a0ead109197b25f..be7d6bed0535ea8721ea6e14c94750df2eba7805 100644 --- a/.gitignore +++ b/.gitignore @@ -251,4 +251,4 @@ paket-files/ .idea/ *.sln.iml /.vs -/src/PearAdmin.AbpTemplate.Admin/App_Data/Logs +**/App_Data/Logs diff --git a/PearAdmin.AbpTemplate.sln b/PearAdmin.AbpTemplate.sln index c84406f31a5fe0ea30295181ed23ba577e2798b1..e845ae237b29c89c7fa75a95a1078fdf49e85781 100644 --- a/PearAdmin.AbpTemplate.sln +++ b/PearAdmin.AbpTemplate.sln @@ -39,6 +39,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PearAdmin.AbpTemplate.MiniP EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PearAdmin.AbpTemplate.ExternalAuth", "module\PearAdmin.AbpTemplate.ExternalAuth\PearAdmin.AbpTemplate.ExternalAuth.csproj", "{B55DAA71-4958-485D-8888-E185C2104931}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "app", "{5470CA36-48C3-4283-B1DB-8D168E57F2A7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service", "service", "{7C235DEB-7400-470D-80AC-003A662F31F3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PearAdmin.AbpTemplate.Api", "src\PearAdmin.AbpTemplate.Api\PearAdmin.AbpTemplate.Api.csproj", "{AF0BE94D-8F47-4FA1-9101-E71699C39F00}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -101,25 +107,32 @@ Global {B55DAA71-4958-485D-8888-E185C2104931}.Debug|Any CPU.Build.0 = Debug|Any CPU {B55DAA71-4958-485D-8888-E185C2104931}.Release|Any CPU.ActiveCfg = Release|Any CPU {B55DAA71-4958-485D-8888-E185C2104931}.Release|Any CPU.Build.0 = Release|Any CPU + {AF0BE94D-8F47-4FA1-9101-E71699C39F00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF0BE94D-8F47-4FA1-9101-E71699C39F00}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF0BE94D-8F47-4FA1-9101-E71699C39F00}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF0BE94D-8F47-4FA1-9101-E71699C39F00}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {0FA75A5B-AB83-4FD0-B545-279774C01E87} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC} - {3870C648-4AEA-4B85-BA3F-F2F63B96136A} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC} + {0FA75A5B-AB83-4FD0-B545-279774C01E87} = {7C235DEB-7400-470D-80AC-003A662F31F3} + {3870C648-4AEA-4B85-BA3F-F2F63B96136A} = {7C235DEB-7400-470D-80AC-003A662F31F3} {0D4C5D00-C144-4213-A007-4B8944113AB1} = {F10AA149-2626-486E-85BB-9CD5365F3016} - {A2213374-BB48-48FD-BBD4-81E6A961D866} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC} - {E0580562-F8F2-4EBB-B07A-ABFC6F2C314F} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC} + {A2213374-BB48-48FD-BBD4-81E6A961D866} = {5470CA36-48C3-4283-B1DB-8D168E57F2A7} + {E0580562-F8F2-4EBB-B07A-ABFC6F2C314F} = {7C235DEB-7400-470D-80AC-003A662F31F3} {CA86CF6F-5D9E-4DAC-9CCB-0F87B519E087} = {F10AA149-2626-486E-85BB-9CD5365F3016} {4A7E8F99-4265-4B66-AB07-B8FAED794DE2} = {F10AA149-2626-486E-85BB-9CD5365F3016} {B02066C3-0275-4DA9-B761-EF78FA7DB2F9} = {0440FD52-239B-40E9-9EBC-34B36F698676} {A0DBEC87-8CB7-4B8C-BD60-EE9FFBA759FB} = {A9CEE774-07BE-415D-935C-D42562C045F9} {5F21891C-72FC-4814-A2B4-3EE7E86F54C2} = {A9CEE774-07BE-415D-935C-D42562C045F9} - {F17AF2E0-E290-43A6-8695-B653FA6446EE} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC} + {F17AF2E0-E290-43A6-8695-B653FA6446EE} = {7C235DEB-7400-470D-80AC-003A662F31F3} {9AFB01E8-783F-472E-90D6-F2A8AD6120FF} = {A9CEE774-07BE-415D-935C-D42562C045F9} {A285A2DC-3435-48A4-B005-D47710AA351D} = {A9CEE774-07BE-415D-935C-D42562C045F9} {B55DAA71-4958-485D-8888-E185C2104931} = {A9CEE774-07BE-415D-935C-D42562C045F9} + {5470CA36-48C3-4283-B1DB-8D168E57F2A7} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC} + {7C235DEB-7400-470D-80AC-003A662F31F3} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC} + {AF0BE94D-8F47-4FA1-9101-E71699C39F00} = {7C235DEB-7400-470D-80AC-003A662F31F3} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C6B33810-FA59-48A3-9DC4-F1F0312C57F6} diff --git a/src/PearAdmin.AbpTemplate.Admin/Controllers/AccountController.cs b/src/PearAdmin.AbpTemplate.Admin/Controllers/AccountController.cs index 55c2483fbfda6a41fee4210ff8bd77a1cd438f0d..5df74f1a08b370d54560c1df501fb0f7e91bb3d9 100644 --- a/src/PearAdmin.AbpTemplate.Admin/Controllers/AccountController.cs +++ b/src/PearAdmin.AbpTemplate.Admin/Controllers/AccountController.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Abp.Authorization; +using Abp.Authorization; using Abp.Authorization.Users; using Abp.Configuration.Startup; using Abp.Domain.Uow; @@ -18,6 +15,9 @@ using PearAdmin.AbpTemplate.ExternalAuth; using PearAdmin.AbpTemplate.Identity; using PearAdmin.AbpTemplate.MultiTenancy; using PearAdmin.AbpTemplate.Sessions; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; namespace PearAdmin.AbpTemplate.Admin.Controllers { @@ -268,7 +268,6 @@ namespace PearAdmin.AbpTemplate.Admin.Controllers return defaultValueBuilder(); } - #endregion } } diff --git a/src/PearAdmin.AbpTemplate.Admin/PearAdmin.AbpTemplate.Admin.csproj b/src/PearAdmin.AbpTemplate.Admin/PearAdmin.AbpTemplate.Admin.csproj index 93e030eab430ba7022a8d01a226ef44f7f21e490..0ee5ccc7120ffcae1eca04febdda968c7405274a 100644 --- a/src/PearAdmin.AbpTemplate.Admin/PearAdmin.AbpTemplate.Admin.csproj +++ b/src/PearAdmin.AbpTemplate.Admin/PearAdmin.AbpTemplate.Admin.csproj @@ -1,4 +1,5 @@  + PearAdmin.AbpTemplate.Admin Exe @@ -14,6 +15,7 @@ false true + @@ -21,6 +23,7 @@ + @@ -30,7 +33,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -38,4 +41,5 @@ + \ No newline at end of file diff --git a/src/PearAdmin.AbpTemplate.Admin/Properties/launchSettings.json b/src/PearAdmin.AbpTemplate.Admin/Properties/launchSettings.json index e0fcdf7f5bf6e98b97abf15c23b587fe7d17a078..413b4b793c7c71b6c6a1c151e487506c6ecbf783 100644 --- a/src/PearAdmin.AbpTemplate.Admin/Properties/launchSettings.json +++ b/src/PearAdmin.AbpTemplate.Admin/Properties/launchSettings.json @@ -1,20 +1,5 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:62114/", - "sslPort": 0 - } - }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "PearAdmin.AbpTemplate.Admin": { "commandName": "Project", "launchBrowser": true, diff --git a/src/PearAdmin.AbpTemplate.Admin/appsettings.Development.json b/src/PearAdmin.AbpTemplate.Admin/appsettings.Development.json index 23e02a252059f043697205d3730adbcdc2a9c869..96289c09060539f48dcfec22e7cd884204c86c64 100644 --- a/src/PearAdmin.AbpTemplate.Admin/appsettings.Development.json +++ b/src/PearAdmin.AbpTemplate.Admin/appsettings.Development.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Default": "Server=cdb-9qxfgkob.gz.tencentcdb.com; Database=PearAdminAbpDemoDb;Port=10143;charset=utf8;uid=pearadmindemodb;pwd=pearadmindemodb@test;", + "Default": "", "Redis": "" }, "App": { diff --git a/src/PearAdmin.AbpTemplate.Admin/appsettings.Stage.json b/src/PearAdmin.AbpTemplate.Admin/appsettings.Staging.json similarity index 100% rename from src/PearAdmin.AbpTemplate.Admin/appsettings.Stage.json rename to src/PearAdmin.AbpTemplate.Admin/appsettings.Staging.json diff --git a/src/PearAdmin.AbpTemplate.Api/AbpTemplateApiModule.cs b/src/PearAdmin.AbpTemplate.Api/AbpTemplateApiModule.cs new file mode 100644 index 0000000000000000000000000000000000000000..71081c7f44aac4c7bd7b2b070ad675d5a7788ca6 --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/AbpTemplateApiModule.cs @@ -0,0 +1,69 @@ +using Abp.AspNetCore; +using Abp.AspNetCore.Configuration; +using Abp.AspNetCore.SignalR; +using Abp.Hangfire; +using Abp.MailKit; +using Abp.Modules; +using Abp.Reflection.Extensions; +using Abp.Timing; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc.ApplicationParts; +using Microsoft.Extensions.Configuration; +using PearAdmin.AbpTemplate.Api.Extensions; +using PearAdmin.AbpTemplate.EntityFrameworkCore; +using PearAdmin.AbpTemplate.Gateway; +using PearAdmin.AbpTemplate.Timing; + +namespace PearAdmin.AbpTemplate.Api +{ + [DependsOn( + typeof(AbpTemplateApplicationModule), + typeof(AbpTemplateEntityFrameworkModule), + typeof(AbpTemplateGatewayModule), + typeof(AbpAspNetCoreModule), + typeof(AbpAspNetCoreSignalRModule), + typeof(AbpHangfireAspNetCoreModule), + typeof(AbpMailKitModule) + )] + public class AbpTemplateApiModule : AbpModule + { + private readonly IWebHostEnvironment _env; + private readonly IConfigurationRoot _appConfiguration; + + public AbpTemplateApiModule(IWebHostEnvironment env) + { + _env = env; + _appConfiguration = env.GetAppConfiguration(); + } + + public override void PreInitialize() + { + Configuration.Auditing.IsEnabledForAnonymousUsers = true; + + // 链接字符串设置 + Configuration.DefaultNameOrConnectionString = _appConfiguration.GetConnectionString(AbpTemplateCoreConsts.ConnectionStringName); + + Configuration.Modules.AbpAspNetCore() + .CreateControllersForAppServices( + typeof(AbpTemplateApplicationModule).GetAssembly() + ); + } + + public override void Initialize() + { + IocManager.RegisterAssemblyByConvention(typeof(AbpTemplateApiModule).GetAssembly()); + } + + public override void PostInitialize() + { + IocManager.Resolve().StartupTime = Clock.Now; + IocManager.Resolve() + .AddApplicationPartsIfNotAddedBefore(typeof(AbpTemplateApiModule).Assembly); + } + + public override void Shutdown() + { + base.Shutdown(); + } + } +} diff --git a/src/PearAdmin.AbpTemplate.Api/Controllers/HomeController.cs b/src/PearAdmin.AbpTemplate.Api/Controllers/HomeController.cs new file mode 100644 index 0000000000000000000000000000000000000000..71e003ff2381e4ca085965bcd348cc135522bc68 --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/Controllers/HomeController.cs @@ -0,0 +1,16 @@ +using Abp.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Mvc; + +namespace PearAdmin.AbpTemplate.Api.Controllers +{ + [ApiController] + [Route("[controller]")] + public class HomeController : AbpController + { + [HttpGet] + public IActionResult Index() + { + return Redirect("/swagger"); + } + } +} diff --git a/src/PearAdmin.AbpTemplate.Api/Dockerfile b/src/PearAdmin.AbpTemplate.Api/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0ea236c8a925b3204b072a0e18b79227b0a7e2d3 --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/Dockerfile @@ -0,0 +1,33 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 + +RUN apt-get update -y && apt-get install -y libgdiplus && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +RUN echo 'Asia/Shanghai' >/etc/timezone + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["src/PearAdmin.AbpTemplate.Api/PearAdmin.AbpTemplate.Api.csproj", "src/PearAdmin.AbpTemplate.Api/"] +COPY ["module/PearAdmin.AbpTemplate.NLog/PearAdmin.AbpTemplate.NLog.csproj", "module/PearAdmin.AbpTemplate.NLog/"] +COPY ["src/PearAdmin.AbpTemplate.Application/PearAdmin.AbpTemplate.Application.csproj", "src/PearAdmin.AbpTemplate.Application/"] +COPY ["src/PearAdmin.AbpTemplate.Core/PearAdmin.AbpTemplate.Core.csproj", "src/PearAdmin.AbpTemplate.Core/"] +COPY ["tool/PearAdmin.AbpTemplate.Shared/PearAdmin.AbpTemplate.Shared.csproj", "tool/PearAdmin.AbpTemplate.Shared/"] +COPY ["module/PearAdmin.AbpTemplate.Storage.Minio/PearAdmin.AbpTemplate.Storage.Minio.csproj", "module/PearAdmin.AbpTemplate.Storage.Minio/"] +COPY ["module/PearAdmin.AbpTemplate.Storage/PearAdmin.AbpTemplate.Storage.csproj", "module/PearAdmin.AbpTemplate.Storage/"] +COPY ["src/PearAdmin.AbpTemplate.EntityFrameworkCore/PearAdmin.AbpTemplate.EntityFrameworkCore.csproj", "src/PearAdmin.AbpTemplate.EntityFrameworkCore/"] +COPY ["src/PearAdmin.AbpTemplate.Gateway/PearAdmin.AbpTemplate.Gateway.csproj", "src/PearAdmin.AbpTemplate.Gateway/"] +RUN dotnet restore "src/PearAdmin.AbpTemplate.Api/PearAdmin.AbpTemplate.Api.csproj" +COPY . . +WORKDIR "/src/src/PearAdmin.AbpTemplate.Api" +RUN dotnet build "PearAdmin.AbpTemplate.Api.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "PearAdmin.AbpTemplate.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "PearAdmin.AbpTemplate.Api.dll"] \ No newline at end of file diff --git a/src/PearAdmin.AbpTemplate.Api/Extensions/AbpBootstrapperOptionsExtension.cs b/src/PearAdmin.AbpTemplate.Api/Extensions/AbpBootstrapperOptionsExtension.cs new file mode 100644 index 0000000000000000000000000000000000000000..823d05fcadf4c73ae8f02e3cda245636be9a1bfe --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/Extensions/AbpBootstrapperOptionsExtension.cs @@ -0,0 +1,17 @@ +using Abp; +using Castle.Facilities.Logging; +using Microsoft.Extensions.Configuration; +using System; +using PearAdmin.AbpTemplate.NLog; + +namespace PearAdmin.AbpTemplate.Api.Extensions +{ + public class AbpBootstrapperOptionsExtension + { + public static Action GetOptions(IConfiguration configuration) + { + return options => options.IocManager.IocContainer + .AddFacility(f => f.UseAbpNLog(configuration.GetSection("NLog"))); + } + } +} diff --git a/src/PearAdmin.AbpTemplate.Api/Extensions/AuthConfigurerExtension.cs b/src/PearAdmin.AbpTemplate.Api/Extensions/AuthConfigurerExtension.cs new file mode 100644 index 0000000000000000000000000000000000000000..6d328f67273626cd08c38947a4939694f32c0544 --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/Extensions/AuthConfigurerExtension.cs @@ -0,0 +1,79 @@ +using Abp.Runtime.Security; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.IdentityModel.Tokens; +using System; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PearAdmin.AbpTemplate.Api.Extensions +{ + public static class AuthConfigurerExtension + { + public static void AuthConfigure(this IServiceCollection services, IConfiguration configuration) + { + if (bool.Parse(configuration["Authentication:JwtBearer:IsEnabled"])) + { + services.AddAuthentication(options => + { + options.DefaultAuthenticateScheme = "JwtBearer"; + options.DefaultChallengeScheme = "JwtBearer"; + }).AddJwtBearer("JwtBearer", options => + { + options.Audience = configuration["Authentication:JwtBearer:Audience"]; + + options.TokenValidationParameters = new TokenValidationParameters + { + // The signing key must match! + ValidateIssuerSigningKey = true, + IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(configuration["Authentication:JwtBearer:SecurityKey"])), + + // Validate the JWT Issuer (iss) claim + ValidateIssuer = true, + ValidIssuer = configuration["Authentication:JwtBearer:Issuer"], + + // Validate the JWT Audience (aud) claim + ValidateAudience = true, + ValidAudience = configuration["Authentication:JwtBearer:Audience"], + + // Validate the token expiry + ValidateLifetime = true, + + // If you want to allow a certain amount of clock drift, set that here + ClockSkew = TimeSpan.Zero + }; + + options.Events = new JwtBearerEvents + { + OnMessageReceived = QueryStringTokenResolver + }; + }); + } + } + + /* This method is needed to authorize SignalR javascript client. + * SignalR can not send authorization header. So, we are getting it from query string as an encrypted text. */ + private static Task QueryStringTokenResolver(MessageReceivedContext context) + { + if (!context.HttpContext.Request.Path.HasValue || + !context.HttpContext.Request.Path.Value.StartsWith("/signalr")) + { + // We are just looking for signalr clients + return Task.CompletedTask; + } + + var qsAuthToken = context.HttpContext.Request.Query["enc_auth_token"].FirstOrDefault(); + if (qsAuthToken == null) + { + // Cookie value does not matches to querystring value + return Task.CompletedTask; + } + + // Set auth token from cookie + context.Token = SimpleStringCipher.Instance.Decrypt(qsAuthToken); + return Task.CompletedTask; + } + } +} diff --git a/src/PearAdmin.AbpTemplate.Api/Extensions/HostingEnvironmentExtension.cs b/src/PearAdmin.AbpTemplate.Api/Extensions/HostingEnvironmentExtension.cs new file mode 100644 index 0000000000000000000000000000000000000000..902b2dac20b41b04c1d11d71e6cc1c0fe608d24e --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/Extensions/HostingEnvironmentExtension.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using PearAdmin.AbpTemplate.Configuration; + +namespace PearAdmin.AbpTemplate.Api.Extensions +{ + public static class HostingEnvironmentExtension + { + public static IConfigurationRoot GetAppConfiguration(this IWebHostEnvironment env) + { + return AppConfigurations.Get(env.ContentRootPath, env.EnvironmentName, env.IsDevelopment()); + } + } +} diff --git a/src/PearAdmin.AbpTemplate.Api/PearAdmin.AbpTemplate.Api.csproj b/src/PearAdmin.AbpTemplate.Api/PearAdmin.AbpTemplate.Api.csproj new file mode 100644 index 0000000000000000000000000000000000000000..64afd8be30a82591c7a9f6a340606d313d6f8db2 --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/PearAdmin.AbpTemplate.Api.csproj @@ -0,0 +1,44 @@ + + + + net6.0 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + true + PearAdmin.AbpTemplate.Api + Exe + PearAdmin.AbpTemplate.Api + PearAdmin-AbpTemplate-56C2EF2F-ABD6-4EFC-AAF2-2E81C34E8FB1 + true + true + false + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/PearAdmin.AbpTemplate.Api/Program.cs b/src/PearAdmin.AbpTemplate.Api/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..788b3429ae7d06d5d5c7ae6ef8e4205d0ad0a4f1 --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/Program.cs @@ -0,0 +1,30 @@ +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; + +namespace PearAdmin.AbpTemplate.Api +{ + public class Program + { + public static void Main(string[] args) + { + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) + { + return WebHost.CreateDefaultBuilder(args) + .UseStartup() + .ConfigureLogging((hostingContext, logging) => + { + logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")) + .AddDebug() + .AddEventSourceLogger() + .AddFilter("System", LogLevel.Debug) + .AddFilter("Microsoft.EntityFrameworkCore.*", LogLevel.Warning) + .AddFilter("Microsoft.AspNetCore.*", LogLevel.Error); + }) + .Build(); + } + } +} diff --git a/src/PearAdmin.AbpTemplate.Api/Properties/launchSettings.json b/src/PearAdmin.AbpTemplate.Api/Properties/launchSettings.json new file mode 100644 index 0000000000000000000000000000000000000000..73d4a27ff888c4c63ef45afa68dbc48504f87b91 --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/Properties/launchSettings.json @@ -0,0 +1,14 @@ +{ + "profiles": { + "PearAdmin.AbpTemplate.Api": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger/index.html", + "applicationUrl": "https://localhost:6001;http://localhost:6000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/PearAdmin.AbpTemplate.Api/Startup.cs b/src/PearAdmin.AbpTemplate.Api/Startup.cs new file mode 100644 index 0000000000000000000000000000000000000000..bd55c06ccfe6729792960c52c2a50b5242569284 --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/Startup.cs @@ -0,0 +1,110 @@ +using Abp.AspNetCore; +using Abp.AspNetCore.Mvc.Antiforgery; +using Abp.AspNetCore.SignalR.Hubs; +using Abp.Dependency; +using Abp.Json; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; +using Newtonsoft.Json.Serialization; +using PearAdmin.AbpTemplate.Api.Extensions; +using PearAdmin.AbpTemplate.Identity; +using System; + +namespace PearAdmin.AbpTemplate.Api +{ + public class Startup + { + private const string _apiVersion = "v1"; + private readonly IConfigurationRoot Configuration; + + public Startup(IWebHostEnvironment env) + { + Configuration = env.GetAppConfiguration(); + } + + public IServiceProvider ConfigureServices(IServiceCollection services) + { + #region MVC + services.AddControllersWithViews(options => + { + options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute()); + }).AddNewtonsoftJson(options => + { + options.SerializerSettings.ContractResolver = new AbpMvcContractResolver(IocManager.Instance) + { + NamingStrategy = new CamelCaseNamingStrategy() + }; + }); + #endregion + + #region Identity + IdentityRegistrar.Register(services); + services.AuthConfigure(Configuration); + #endregion + + #region SignalR + services.AddSignalR(); + #endregion + + #region Swagger + services.AddSwaggerGen(options => + { + options.SwaggerDoc(_apiVersion, new OpenApiInfo + { + Version = _apiVersion, + Title = "PearAdmin AbpTemplate API", + Description = "PearAdmin AbpTemplate", + // uncomment if needed TermsOfService = new Uri("https://example.com/terms"), + Contact = new OpenApiContact + { + Name = "PearAdmin AbpTemplate", + Email = string.Empty, + Url = new Uri("https://twitter.com/aspboilerplate"), + }, + License = new OpenApiLicense + { + Name = "MIT License", + Url = new Uri("https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/LICENSE"), + } + }); + options.DocInclusionPredicate((docName, description) => true); + options.AddSecurityDefinition("BearerAuth", new OpenApiSecurityScheme() + { + Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", + Name = "Authorization", + In = ParameterLocation.Header, + Type = SecuritySchemeType.ApiKey + }); + }); + #endregion + + return services.AddAbp(AbpBootstrapperOptionsExtension.GetOptions(Configuration)); + } + + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) + { + app.UseAbp(options => { options.UseAbpRequestLocalization = false; }); + app.UseStaticFiles(); + app.UseRouting(); + app.UseAuthentication(); + app.UseAuthorization(); + app.UseAbpRequestLocalization(); + app.UseEndpoints(endpoints => + { + endpoints.MapHub("/signalr"); + endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); + endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}"); + }); + app.UseSwagger(c => { c.RouteTemplate = "swagger/{documentName}/swagger.json"; }); + app.UseSwaggerUI(options => + { + options.SwaggerEndpoint($"/swagger/{_apiVersion}/swagger.json", $"PearAdmin AbpTemplate API {_apiVersion}"); + options.DisplayRequestDuration(); + }); + } + } +} diff --git a/src/PearAdmin.AbpTemplate.Api/appsettings.Development.json b/src/PearAdmin.AbpTemplate.Api/appsettings.Development.json new file mode 100644 index 0000000000000000000000000000000000000000..1f4f80f8f5dc8ae0e7ccdc94f3f65c0945ec19aa --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/appsettings.Development.json @@ -0,0 +1,5 @@ +{ + "ConnectionStrings": { + "Default": "" + } +} \ No newline at end of file diff --git a/src/PearAdmin.AbpTemplate.Api/appsettings.Production.json b/src/PearAdmin.AbpTemplate.Api/appsettings.Production.json new file mode 100644 index 0000000000000000000000000000000000000000..1f4f80f8f5dc8ae0e7ccdc94f3f65c0945ec19aa --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/appsettings.Production.json @@ -0,0 +1,5 @@ +{ + "ConnectionStrings": { + "Default": "" + } +} \ No newline at end of file diff --git a/src/PearAdmin.AbpTemplate.Api/appsettings.Staging.json b/src/PearAdmin.AbpTemplate.Api/appsettings.Staging.json new file mode 100644 index 0000000000000000000000000000000000000000..1f4f80f8f5dc8ae0e7ccdc94f3f65c0945ec19aa --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/appsettings.Staging.json @@ -0,0 +1,5 @@ +{ + "ConnectionStrings": { + "Default": "" + } +} \ No newline at end of file diff --git a/src/PearAdmin.AbpTemplate.Api/appsettings.json b/src/PearAdmin.AbpTemplate.Api/appsettings.json new file mode 100644 index 0000000000000000000000000000000000000000..0e1ffe8c6a75c5e35f9deeea3189311ddf66fc78 --- /dev/null +++ b/src/PearAdmin.AbpTemplate.Api/appsettings.json @@ -0,0 +1,59 @@ +{ + "ConnectionStrings": { + "Default": "" + }, + "Authentication": { + "JwtBearer": { + "IsEnabled": "true", + "SecurityKey": "PearAdmin.AbpTemplate.Api_635AD546DE4B46C6", + "Issuer": "PearAdmin.AbpTemplate.Api", + "Audience": "PearAdmin.AbpTemplate.Api" + } + }, + "NLog": { + "autoReload": true, + "throwConfigExceptions": true, + "internalLogLevel": "Info", + "internalLogFile": "App_Data/Logs/nlogs.txt", + "extensions": [ + { + "NLog.Web.AspNetCore": { + "assembly": "NLog.Web.AspNetCore" + } + } + ], + "targets": { + "allfile": { + "maxArchiveDays": 3, + "maxArchiveFiles": 3, + "type": "File", + "fileName": "App_Data/Logs/nlog-all-${shortdate}.log", + "layout": "${longdate}||${level}||${logger}||${message}||${exception:format=ToString:innerFormat=ToString:maxInnerExceptionLevel=10:separator=\\r\\n}||end" + }, + "ownFile-web": { + "maxArchiveDays": 3, + "maxArchiveFiles": 3, + "type": "File", + "fileName": "App_Data/Logs/nlog-my-${shortdate}.log", + "layout": "${longdate}||${level}||${logger}||${message}||${exception:format=ToString:innerFormat=ToString:maxInnerExceptionLevel=10:separator=\\r\\n}||end" + } + }, + "rules": [ + { + "logger": "*", + "minLevel": "Trace", + "writeTo": "allfile" + }, + { + "logger": "*", + "minLevel": "Trace", + "writeTo": "ownFile-web" + }, + { + "logger": "Microsoft.*", + "maxLevel": "Info", + "final": true + } + ] + } +} \ No newline at end of file diff --git a/src/PearAdmin.AbpTemplate.Application/Authorization/Accounts/IAccountAppService.cs b/src/PearAdmin.AbpTemplate.Application/Authorization/Accounts/IAccountAppService.cs index ebb9cd3369328289f2305cd5f337d73b7cb042d6..1bccfaa03bcd10ce42582d31fbcfa8247543da0a 100644 --- a/src/PearAdmin.AbpTemplate.Application/Authorization/Accounts/IAccountAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Authorization/Accounts/IAccountAppService.cs @@ -1,10 +1,11 @@ using System.Threading.Tasks; using Abp.Application.Services; +using Abp.Dependency; using PearAdmin.AbpTemplate.Authorization.Accounts.Dto; namespace PearAdmin.AbpTemplate.Authorization.Accounts { - public interface IAccountAppService : IApplicationService + public interface IAccountAppService : IApplicationService, ITransientDependency { Task IsTenantAvailable(IsTenantAvailableInput input); diff --git a/src/PearAdmin.AbpTemplate.Application/Authorization/Permissions/IPermissionAppService.cs b/src/PearAdmin.AbpTemplate.Application/Authorization/Permissions/IPermissionAppService.cs index b1c884da6b29a583beacae68df0f76af3e91c030..1c04aebb19922b2e90d9db14293878a9efbe7fc5 100644 --- a/src/PearAdmin.AbpTemplate.Application/Authorization/Permissions/IPermissionAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Authorization/Permissions/IPermissionAppService.cs @@ -1,10 +1,11 @@ using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.Authorization.Permissions.Dto; namespace PearAdmin.AbpTemplate.Authorization.Permissions { - public interface IPermissionAppService : IApplicationService + public interface IPermissionAppService : IApplicationService, ITransientDependency { /// /// 分页筛选获取权限树结构(树形结构数据) diff --git a/src/PearAdmin.AbpTemplate.Application/Authorization/Roles/IRoleAppService.cs b/src/PearAdmin.AbpTemplate.Application/Authorization/Roles/IRoleAppService.cs index cf7c82fb9fb506054f7a826ba841ec3e6d1b9ceb..8c3d505415278fd2497bfedd135bc129ec2c519e 100644 --- a/src/PearAdmin.AbpTemplate.Application/Authorization/Roles/IRoleAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Authorization/Roles/IRoleAppService.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.Authorization.Roles.Dto; namespace PearAdmin.AbpTemplate.Authorization.Roles @@ -9,7 +10,7 @@ namespace PearAdmin.AbpTemplate.Authorization.Roles /// /// 角色应用服务 /// - public interface IRoleAppService : IApplicationService + public interface IRoleAppService : IApplicationService, ITransientDependency { /// /// 获取所有角色 diff --git a/src/PearAdmin.AbpTemplate.Application/Authorization/Users/IUserAppService.cs b/src/PearAdmin.AbpTemplate.Application/Authorization/Users/IUserAppService.cs index 00fa40f4fbc805425a41ff5f4069e6535d31e107..dd78bf5094724e29eb046025979c25d51ebedec8 100644 --- a/src/PearAdmin.AbpTemplate.Application/Authorization/Users/IUserAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Authorization/Users/IUserAppService.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.Authorization.Users.Dto; namespace PearAdmin.AbpTemplate.Authorization.Users @@ -9,7 +10,7 @@ namespace PearAdmin.AbpTemplate.Authorization.Users /// /// 用户应用服务接口 /// - public interface IUserAppService : IApplicationService + public interface IUserAppService : IApplicationService, ITransientDependency { /// /// 分页获取用户列表 diff --git a/src/PearAdmin.AbpTemplate.Application/Common/Sessions/ISessionAppService.cs b/src/PearAdmin.AbpTemplate.Application/Common/Sessions/ISessionAppService.cs index 19108500575c0d652c35577ef07d66b7086ebd02..2b51237cd24d99d1dc2b82898dbaf0e9dac8ac7d 100644 --- a/src/PearAdmin.AbpTemplate.Application/Common/Sessions/ISessionAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Common/Sessions/ISessionAppService.cs @@ -1,10 +1,11 @@ using System.Threading.Tasks; using Abp.Application.Services; +using Abp.Dependency; using PearAdmin.AbpTemplate.Sessions.Dto; namespace PearAdmin.AbpTemplate.Sessions { - public interface ISessionAppService : IApplicationService + public interface ISessionAppService : IApplicationService, ITransientDependency { Task GetCurrentLoginInformations(); } diff --git a/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/GeneralSettingsEditDto.cs b/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/HostGeneralSettingsEditDto.cs similarity index 87% rename from src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/GeneralSettingsEditDto.cs rename to src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/HostGeneralSettingsEditDto.cs index 9282579ca03b2927f47add02247c0fc29086020b..eb8766b12b54c01ae0973fe74d6eccf957e18134 100644 --- a/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/GeneralSettingsEditDto.cs +++ b/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/HostGeneralSettingsEditDto.cs @@ -1,6 +1,6 @@ namespace PearAdmin.AbpTemplate.Host.HostSettings.Dto { - public class GeneralSettingsEditDto + public class HostGeneralSettingsEditDto { public string Timezone { get; set; } diff --git a/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/HostSettingsEditDto.cs b/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/HostSettingsEditDto.cs index 425f49992a121fb50de53e508082c15d71b4ba1a..2268d89e3d88e2ede5e12c1ffb4afbe0a14acc3d 100644 --- a/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/HostSettingsEditDto.cs +++ b/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/Dto/HostSettingsEditDto.cs @@ -5,7 +5,7 @@ namespace PearAdmin.AbpTemplate.Host.HostSettings.Dto public class HostSettingsEditDto { [Required] - public GeneralSettingsEditDto General { get; set; } + public HostGeneralSettingsEditDto General { get; set; } [Required] public HostManagementSettingsEditDto HostManagement { get; set; } diff --git a/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/HostSettingsAppService.cs b/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/HostSettingsAppService.cs index 03bade88051640a74f131c8f8e5d4be122ff5ac0..0d3bcc11f44c9840f0f351bfaed39331dfae6e79 100644 --- a/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/HostSettingsAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/HostSettingsAppService.cs @@ -33,10 +33,10 @@ namespace PearAdmin.AbpTemplate.Host.HostSettings }; } - private async Task GetGeneralSettingsAsync() + private async Task GetGeneralSettingsAsync() { var timezone = await SettingManager.GetSettingValueForApplicationAsync(TimingSettingNames.TimeZone); - var settings = new GeneralSettingsEditDto + var settings = new HostGeneralSettingsEditDto { Timezone = timezone, TimezoneForComparison = timezone @@ -72,7 +72,7 @@ namespace PearAdmin.AbpTemplate.Host.HostSettings await UpdateHostManagementAsync(input.HostManagement); } - private async Task UpdateGeneralSettingsAsync(GeneralSettingsEditDto settings) + private async Task UpdateGeneralSettingsAsync(HostGeneralSettingsEditDto settings) { if (Clock.SupportsMultipleTimezone) { diff --git a/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/IHostSettingsAppService.cs b/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/IHostSettingsAppService.cs index 18092847e80d03eedd98403465c7613fe7abf1d2..b8d89a868f6f3aa1ffbf1cc7ce8632a48e39cd2c 100644 --- a/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/IHostSettingsAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Host/HostSettings/IHostSettingsAppService.cs @@ -1,10 +1,11 @@ using System.Threading.Tasks; using Abp.Application.Services; +using Abp.Dependency; using PearAdmin.AbpTemplate.Host.HostSettings.Dto; namespace PearAdmin.AbpTemplate.Host.HostSettings { - public interface IHostSettingsAppService : IApplicationService + public interface IHostSettingsAppService : IApplicationService, ITransientDependency { Task GetAllSettings(); diff --git a/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/AuditLogAppService.cs b/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/AuditLogAppService.cs index 0915af05ef9d5629d1b6e17ee0949fb78faac091..dee680ec670e09e211cf292523384f0355fad8a9 100644 --- a/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/AuditLogAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/AuditLogAppService.cs @@ -197,7 +197,7 @@ namespace PearAdmin.AbpTemplate.Auditing var entityChangeListDtos = ConvertToEntityChangeListDtos(entityChanges); - return _auditLogListExcelExporter.ExportToFile(entityChangeListDtos); + return _auditLogListExcelExporter.BatchExportToFile(entityChangeListDtos); } public async Task> GetEntityPropertyChanges(long entityChangeId) diff --git a/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/Exporting/AuditLogListExcelExporter.cs b/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/Exporting/AuditLogListExcelExporter.cs index ad32f7b2012d07ff1ef4f698acfb27a9be58a1cd..0e326b07b7faf8b7600e5fbb9a30fb66629b8dc5 100644 --- a/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/Exporting/AuditLogListExcelExporter.cs +++ b/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/Exporting/AuditLogListExcelExporter.cs @@ -78,7 +78,7 @@ namespace PearAdmin.AbpTemplate.Auditing.Exporting }); } - public FileDto ExportToFile(List entityChangeListDtos) + public FileDto BatchExportToFile(List entityChangeListDtos) { return CreateExcelPackage( "DetailedLogs.xlsx", diff --git a/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/Exporting/IAuditLogListExcelExporter.cs b/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/Exporting/IAuditLogListExcelExporter.cs index 57edf20a79e0633c54070a4b944fecec7bb1f348..f05fd3515fd79e55cc303d2cc4001eb773af981e 100644 --- a/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/Exporting/IAuditLogListExcelExporter.cs +++ b/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/Exporting/IAuditLogListExcelExporter.cs @@ -1,13 +1,14 @@ using System.Collections.Generic; +using Abp.Dependency; using PearAdmin.AbpTemplate.Auditing.Dto; using PearAdmin.AbpTemplate.CommonDto; namespace PearAdmin.AbpTemplate.Auditing.Exporting { - public interface IAuditLogListExcelExporter + public interface IAuditLogListExcelExporter: ITransientDependency { FileDto ExportToFile(List auditLogListDtos); - FileDto ExportToFile(List entityChangeListDtos); + FileDto BatchExportToFile(List entityChangeListDtos); } } diff --git a/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/IAuditLogAppService.cs b/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/IAuditLogAppService.cs index dfad23eaff10ed2934a0a3439bd0948282ac5ba2..128360a8e871a47ff14982cd9871445d2f4869e8 100644 --- a/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/IAuditLogAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Monitoring/Auditing/IAuditLogAppService.cs @@ -2,12 +2,13 @@ using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.Auditing.Dto; using PearAdmin.AbpTemplate.CommonDto; namespace PearAdmin.AbpTemplate.Auditing { - public interface IAuditLogAppService : IApplicationService + public interface IAuditLogAppService : IApplicationService, ITransientDependency { /// /// 分页、筛选审计日志列表 diff --git a/src/PearAdmin.AbpTemplate.Application/Monitoring/Loggings/IWebSiteLogAppService.cs b/src/PearAdmin.AbpTemplate.Application/Monitoring/Loggings/IWebSiteLogAppService.cs index 896fff639e259f41411d390ed008310309360655..ba0a95f0a82901a0eb55669ee4933fe55d4adcec 100644 --- a/src/PearAdmin.AbpTemplate.Application/Monitoring/Loggings/IWebSiteLogAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Monitoring/Loggings/IWebSiteLogAppService.cs @@ -1,4 +1,5 @@ using Abp.Application.Services; +using Abp.Dependency; using PearAdmin.AbpTemplate.CommonDto; using PearAdmin.AbpTemplate.Loggings.Dto; @@ -7,7 +8,7 @@ namespace PearAdmin.AbpTemplate.Loggings /// /// 网站运行日志应用层服务 /// - public interface IWebSiteLogAppService : IApplicationService + public interface IWebSiteLogAppService : IApplicationService, ITransientDependency { /// /// 获取最近的一个日志文件 diff --git a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/Editions/IEditionAppService.cs b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/Editions/IEditionAppService.cs index fe5216d6bb6c4e45e78a4941ac1e9782e1fc20ca..8ed33a771dc97b2fa5ddf6f15ad59ebeee72191f 100644 --- a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/Editions/IEditionAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/Editions/IEditionAppService.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.MultiTenancy.Editions.Dto; namespace PearAdmin.AbpTemplate.MultiTenancy.Editions @@ -8,7 +9,7 @@ namespace PearAdmin.AbpTemplate.MultiTenancy.Editions /// /// 版本管理应用服务接口 /// - public interface IEditionAppService : IApplicationService + public interface IEditionAppService : IApplicationService, ITransientDependency { /// /// 获取全部版本列表 diff --git a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/GeneralSettingsEditDto.cs b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/TenantGeneralSettingsEditDto.cs similarity index 87% rename from src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/GeneralSettingsEditDto.cs rename to src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/TenantGeneralSettingsEditDto.cs index 89a320f07ccfc9fa36c51a0f6693280399d164f6..90e9fcf43d8502b406723caf1dfdea5691e2c2b0 100644 --- a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/GeneralSettingsEditDto.cs +++ b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/TenantGeneralSettingsEditDto.cs @@ -1,6 +1,6 @@ namespace PearAdmin.AbpTemplate.MultiTenancy.TenantSetting.Dto { - public class GeneralSettingsEditDto + public class TenantGeneralSettingsEditDto { public string Timezone { get; set; } diff --git a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/TenantSettingsEditDto.cs b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/TenantSettingsEditDto.cs index b21611674b19e9119b6d773c470ef42aeb81e9c8..7b540a35d475d8e5fdd06fb46f6fd866938816e6 100644 --- a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/TenantSettingsEditDto.cs +++ b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/Dto/TenantSettingsEditDto.cs @@ -2,7 +2,7 @@ { public class TenantSettingsEditDto { - public GeneralSettingsEditDto General { get; set; } + public TenantGeneralSettingsEditDto General { get; set; } public TenantEmailSettingsEditDto Email { get; set; } diff --git a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/ITenantSettingsAppService.cs b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/ITenantSettingsAppService.cs index 4cfd56a28a405d74d40b12a26ee9dca241c46c03..a1946b22dae48bc9f7cf2610d44c95fd0d14f04c 100644 --- a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/ITenantSettingsAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/ITenantSettingsAppService.cs @@ -1,10 +1,11 @@ using System.Threading.Tasks; using Abp.Application.Services; +using Abp.Dependency; using PearAdmin.AbpTemplate.MultiTenancy.TenantSetting.Dto; namespace PearAdmin.AbpTemplate.MultiTenancy.TenantSetting { - public interface ITenantSettingsAppService : IApplicationService + public interface ITenantSettingsAppService : IApplicationService, ITransientDependency { Task GetAllSettings(); diff --git a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/TenantSettingsAppService.cs b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/TenantSettingsAppService.cs index a83b76c53226379b135bd116533665fb2fe6ef76..1d45bb80f228be6ed34655b090ee6f4f7849b0a4 100644 --- a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/TenantSettingsAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/TenantSettings/TenantSettingsAppService.cs @@ -84,9 +84,9 @@ namespace PearAdmin.AbpTemplate.MultiTenancy.TenantSetting }; } - private async Task GetGeneralSettingsAsync() + private async Task GetGeneralSettingsAsync() { - var settings = new GeneralSettingsEditDto(); + var settings = new TenantGeneralSettingsEditDto(); if (Clock.SupportsMultipleTimezone) { diff --git a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/Tenants/ITenantAppService.cs b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/Tenants/ITenantAppService.cs index 6540389cfc775c5685769a4d4d685be5d4077e3b..13e183f9ab2c36d8c750438e3d8283dfaf02a38b 100644 --- a/src/PearAdmin.AbpTemplate.Application/MultiTenancy/Tenants/ITenantAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/MultiTenancy/Tenants/ITenantAppService.cs @@ -1,5 +1,6 @@ using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.MultiTenancy.Tenants.Dto; using System.Threading.Tasks; @@ -8,7 +9,7 @@ namespace PearAdmin.AbpTemplate.MultiTenancy.Tenants /// /// 租户应用服务 /// - public interface ITenantAppService : IApplicationService + public interface ITenantAppService : IApplicationService, ITransientDependency { /// /// 获取全部租户 diff --git a/src/PearAdmin.AbpTemplate.Application/Notifications/INotificationAppService.cs b/src/PearAdmin.AbpTemplate.Application/Notifications/INotificationAppService.cs index 82d373f5d3017340b17d75125c3452c36ec1014e..c26a18d3a989955ee42aac5264a6b57f6933b6ba 100644 --- a/src/PearAdmin.AbpTemplate.Application/Notifications/INotificationAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Notifications/INotificationAppService.cs @@ -1,5 +1,6 @@ using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.Notifications.Dto; using System; using System.Collections.Generic; @@ -10,7 +11,7 @@ namespace PearAdmin.AbpTemplate.Notifications /// /// 消息应用层服务 /// - public interface INotificationAppService : IApplicationService + public interface INotificationAppService : IApplicationService, ITransientDependency { /// /// 分页获取消息 diff --git a/src/PearAdmin.AbpTemplate.Application/Organizations/IOrganizationUnitAppService.cs b/src/PearAdmin.AbpTemplate.Application/Organizations/IOrganizationUnitAppService.cs index 3c46b009e51bfbae5b932db6f0933182f84da7a0..8511cb11c5349549b7d308873ba35b2bb726320e 100644 --- a/src/PearAdmin.AbpTemplate.Application/Organizations/IOrganizationUnitAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Organizations/IOrganizationUnitAppService.cs @@ -3,13 +3,14 @@ using Abp.Application.Services.Dto; using System.Collections.Generic; using System.Threading.Tasks; using PearAdmin.AbpTemplate.Organizations.Dto; +using Abp.Dependency; namespace PearAdmin.AbpTemplate.Organizations { /// /// 组织机构应用服务 /// - public interface IOrganizationUnitAppService : IApplicationService + public interface IOrganizationUnitAppService : IApplicationService, ITransientDependency { /// /// 获取组织机构(树形结构数据) diff --git a/src/PearAdmin.AbpTemplate.Application/Resource/DataDictionaries/IDataDictionaryAppService.cs b/src/PearAdmin.AbpTemplate.Application/Resource/DataDictionaries/IDataDictionaryAppService.cs index d6d1e95bb9cf2333a2599d9a52670f8494143fce..43a3ee1be32e5aa2107155c6e9381848cd8efda5 100644 --- a/src/PearAdmin.AbpTemplate.Application/Resource/DataDictionaries/IDataDictionaryAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Resource/DataDictionaries/IDataDictionaryAppService.cs @@ -1,5 +1,6 @@ using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.Resource.DataDictionaries.Dto; using System.Collections.Generic; using System.Threading.Tasks; @@ -9,7 +10,7 @@ namespace PearAdmin.AbpTemplate.Resource.DataDictionaries /// /// 数据字典应用服务接口 /// - public interface IDataDictionaryAppService : IApplicationService + public interface IDataDictionaryAppService : IApplicationService, ITransientDependency { /// /// 获取数据字典集合 diff --git a/src/PearAdmin.AbpTemplate.Application/Social/Chat/IChatAppService.cs b/src/PearAdmin.AbpTemplate.Application/Social/Chat/IChatAppService.cs index 5a7e9f3ac698de934951863495efb5ad3b8a6949..bb91def274d039b363d07969b2bbcfb55de1ae64 100644 --- a/src/PearAdmin.AbpTemplate.Application/Social/Chat/IChatAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Social/Chat/IChatAppService.cs @@ -1,11 +1,12 @@ using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.Social.Chat.Dto; namespace PearAdmin.AbpTemplate.Social.Chat { - public interface IChatAppService : IApplicationService + public interface IChatAppService : IApplicationService, ITransientDependency { Task> GetAllChatUser(); diff --git a/src/PearAdmin.AbpTemplate.Application/Social/Friendships/IFriendshipAppService.cs b/src/PearAdmin.AbpTemplate.Application/Social/Friendships/IFriendshipAppService.cs index 9ba0a17e20fe5d0f1036304243db0d64cd6b347d..cd1690de76c22681962273373e07d7a21f602a16 100644 --- a/src/PearAdmin.AbpTemplate.Application/Social/Friendships/IFriendshipAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/Social/Friendships/IFriendshipAppService.cs @@ -1,10 +1,11 @@ using System.Threading.Tasks; using Abp.Application.Services; +using Abp.Dependency; using PearAdmin.AbpTemplate.Social.Friendships.Dto; namespace PearAdmin.AbpTemplate.Social.Friendships { - public interface IFriendshipAppService : IApplicationService + public interface IFriendshipAppService : IApplicationService, ITransientDependency { Task CreateFriendshipRequest(CreateFriendshipRequestInput input); diff --git a/src/PearAdmin.AbpTemplate.Application/TaskCenter/DailyTasks/IDailyTaskAppService.cs b/src/PearAdmin.AbpTemplate.Application/TaskCenter/DailyTasks/IDailyTaskAppService.cs index b3dab85b6e94d5cb4776390bf747c29a3d54d8c9..7ee90f13efa8b9fc94ed73529682f56cc2d5bec8 100644 --- a/src/PearAdmin.AbpTemplate.Application/TaskCenter/DailyTasks/IDailyTaskAppService.cs +++ b/src/PearAdmin.AbpTemplate.Application/TaskCenter/DailyTasks/IDailyTaskAppService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; +using Abp.Dependency; using PearAdmin.AbpTemplate.TaskCenter.DailyTasks.Dto; namespace PearAdmin.AbpTemplate.TaskCenter.DailyTasks @@ -10,7 +11,7 @@ namespace PearAdmin.AbpTemplate.TaskCenter.DailyTasks /// /// 日常任务应用服务 /// - public interface IDailyTaskAppService : IApplicationService + public interface IDailyTaskAppService : IApplicationService, ITransientDependency { /// /// 获取日常任务列表