From e92dd48bbf0dc338a3461f2172000bdac365e354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= <454313500@qq.com> Date: Fri, 19 Apr 2024 17:00:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=A9=E5=B1=95=E5=8A=A8=E6=80=81api?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yi.Framework.AspNetCore/Mvc/YiConventionalRouteBuilder.cs | 2 +- .../Yi.Framework.AspNetCore/Mvc/YiServiceConvention.cs | 2 +- Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Mvc/YiConventionalRouteBuilder.cs b/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Mvc/YiConventionalRouteBuilder.cs index 3ee0cb31..dc946ea0 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Mvc/YiConventionalRouteBuilder.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Mvc/YiConventionalRouteBuilder.cs @@ -28,7 +28,7 @@ namespace Yi.Framework.AspNetCore.Mvc var controllerNameInUrl = NormalizeUrlControllerName(rootPath, controllerName, action, httpMethod, configuration); - var url = $"{apiRoutePrefix}/{rootPath}/{NormalizeControllerNameCase(controllerNameInUrl, configuration)}"; + var url = $"{rootPath}/{NormalizeControllerNameCase(controllerNameInUrl, configuration)}"; //Add {id} path if needed var idParameterModel = action.Parameters.FirstOrDefault(p => p.ParameterName == "id"); diff --git a/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Mvc/YiServiceConvention.cs b/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Mvc/YiServiceConvention.cs index f015a6cf..200fcd4b 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Mvc/YiServiceConvention.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Mvc/YiServiceConvention.cs @@ -72,7 +72,7 @@ namespace Yi.Framework.AspNetCore.Mvc var template = selector.AttributeRouteModel.Template; if (!template.StartsWith("/")) { - var route = $"{AbpAspNetCoreConsts.DefaultApiPrefix}/{rootPath}/{template}"; + var route = $"{rootPath}/{template}"; selector.AttributeRouteModel.Template = route; } diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs index 87c382c7..3d02c2ea 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs @@ -78,6 +78,9 @@ namespace Yi.Abp.Web options.ConventionalControllers.Create(typeof(YiFrameworkChatHubApplicationModule).Assembly, options => options.RemoteServiceName = "chat-hub"); options.ConventionalControllers.Create(typeof(YiFrameworkTenantManagementApplicationModule).Assembly, options => options.RemoteServiceName = "tenant-management"); options.ConventionalControllers.Create(typeof(YiFrameworkCodeGenApplicationModule).Assembly, options => options.RemoteServiceName = "code-gen"); + + //统一前缀 + options.ConventionalControllers.ConventionalControllerSettings.ForEach(x => x.RootPath = "api/app"); }); //设置api格式