diff --git a/apps/vue/src/components/Permission/src/PermissionModal.vue b/apps/vue/src/components/Permission/src/PermissionModal.vue index 987ac84e8..a9574966d 100644 --- a/apps/vue/src/components/Permission/src/PermissionModal.vue +++ b/apps/vue/src/components/Permission/src/PermissionModal.vue @@ -59,16 +59,18 @@ - diff --git a/gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayModule.cs b/gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayModule.cs index 6a88a7e13..10123cf45 100644 --- a/gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayModule.cs +++ b/gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayModule.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Builder; +using LINGYUN.Abp.AspNetCore.Mvc.Wrapper; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Rewrite; using Microsoft.Extensions.Configuration; @@ -23,7 +24,8 @@ namespace LY.MicroService.ApiGateway; typeof(AbpAutofacModule), typeof(AbpDataModule), typeof(AbpSwashbuckleModule), - typeof(AbpAspNetCoreSerilogModule) + typeof(AbpAspNetCoreSerilogModule), + typeof(AbpAspNetCoreMvcWrapperModule) )] public class InternalApiGatewayModule : AbpModule { @@ -32,6 +34,18 @@ public class InternalApiGatewayModule : AbpModule var configuration = context.Services.GetConfiguration(); var hostingEnvironment = context.Services.GetHostingEnvironment(); + Configure(options => + { + options.Aggregator.ConfigurationUrl.ClientName = "_Abp_Application_Configuration"; + options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30010")); + options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30015")); + options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30020")); + options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30025")); + options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30030")); + options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30035")); + options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30040")); + }); + context.Services.AddAbpSwaggerGenWithOAuth( authority: configuration["AuthServer:Authority"], scopes: new Dictionary @@ -128,7 +142,7 @@ public class InternalApiGatewayModule : AbpModule app.UseRewriter(new RewriteOptions().AddRedirect("^(|\\|\\s+)$", "/swagger")); app.UseRouting(); - app.UseEndpoints(endpoints => + app.UseConfiguredEndpoints(endpoints => { endpoints.MapReverseProxy(options => options.UseLoadBalancing()); diff --git a/gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayOptions.cs b/gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayOptions.cs new file mode 100644 index 000000000..37ba044c4 --- /dev/null +++ b/gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayOptions.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; + +namespace LY.MicroService.ApiGateway +{ + public class InternalApiGatewayOptions + { + public Aggregator Aggregator { get; set; } + + public InternalApiGatewayOptions() + { + Aggregator = new Aggregator(); + } + } + + public class Aggregator + { + /// + /// 设置聚合路由 + /// + /// + /// 聚合路由: + /// /api/setting-management/settings + /// + /// + /// 宿主端路由: + /// Get: /api/setting-management/settings/by-global + /// Set: /api/setting-management/settings/change-global + /// + /// + /// 租户端路由: + /// Get: /api/setting-management/settings/by-current-tenant + /// Set: /api/setting-management/settings/change-current-tenant + /// + /// + /// 用户端路由: + /// Get: /api/setting-management/settings/by-current-user + /// Set: /api/setting-management/settings/change-current-user + /// + public AggregatorUrl SettingUrl { get; set; } + /// + /// 应用配置聚合路由 + /// + /// + /// 聚合路由: + /// /api/abp/application-configuration + /// + public AggregatorUrl ConfigurationUrl { get; set; } + /// + /// Api接口定义配置聚合路由 + /// + /// + /// 聚合路由: + /// /api/abp/api-definition + /// + public AggregatorUrl ApiDefinitionUrl { get; set; } + public Aggregator() + { + SettingUrl = new AggregatorUrl(); + ConfigurationUrl = new AggregatorUrl(); + ApiDefinitionUrl = new AggregatorUrl(); + } + } + + public class AggregatorUrl + { + public string ClientName { get; set; } + + public HttpHandlerOptions HttpHandler { get; set; } + /// + /// 查询聚合路由列表 + /// + public List GetUrls { get; set; } + /// + /// 变更路由 + /// + public RequestUrl SetUrl { get; set; } + /// + /// 默认超时时间 + /// + /// + /// default: 30s + /// + public TimeSpan? DefaultTimeout { get; set; } + + public AggregatorUrl() + { + HttpHandler = new HttpHandlerOptions(); + GetUrls = new List(); + DefaultTimeout = TimeSpan.FromSeconds(30); + } + } + + public class RequestUrl + { + public HttpMethod Method { get; set; } + public string Url { get; set; } + public RequestUrl() + { + Method = HttpMethod.Get; + } + + public RequestUrl(string url) + : this(HttpMethod.Get, url) + { + } + + public RequestUrl( + HttpMethod method, + string url) + { + Method = method; + Url = url; + } + } + + public class HttpHandlerOptions + { + public bool AllowAutoRedirect { get; set; } + public bool UseCookieContainer { get; set; } + public bool UseTracing { get; set; } + public bool UseProxy { get; set; } + public int MaxConnectionsPerServer { get; set; } + } +} diff --git a/gateways/web/LY.MicroService.ApiGateway/Properties/launchSettings.json b/gateways/web/LY.MicroService.ApiGateway/Properties/launchSettings.json index 8b13bb14e..c1ce8fc58 100644 --- a/gateways/web/LY.MicroService.ApiGateway/Properties/launchSettings.json +++ b/gateways/web/LY.MicroService.ApiGateway/Properties/launchSettings.json @@ -8,7 +8,7 @@ } }, "profiles": { - "PackageName.CompanyName.ProjectName.HttpApi.Host": { + "LY.MicroService.ApiGateway": { "commandName": "Project", "launchBrowser": false, "environmentVariables": { @@ -16,13 +16,6 @@ }, "applicationUrl": "http://localhost:5000", "dotnetRunMessages": "true" - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": false, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } } } } \ No newline at end of file diff --git a/gateways/web/LY.MicroService.ApiGateway/yarp.json b/gateways/web/LY.MicroService.ApiGateway/yarp.json index a10aca999..96a1e688c 100644 --- a/gateways/web/LY.MicroService.ApiGateway/yarp.json +++ b/gateways/web/LY.MicroService.ApiGateway/yarp.json @@ -19,12 +19,6 @@ "Path": "/api/identity-server/{**everything}" } }, - "BackendAdmin": { - "ClusterId": "backendAdminCluster", - "Match": { - "Path": "/api/abp/{**everything}" - } - }, "feature-management-route": { "ClusterId": "feature-management-cluster", "Match": {