From 1257da2c1b3c6b79fbaef5d9693ce693b055d7a9 Mon Sep 17 00:00:00 2001 From: gdlcf88 Date: Mon, 26 Dec 2022 23:13:19 +0800 Subject: [PATCH] Refactor controllers to resolve the ABP route warning --- Directory.Build.props | 2 +- common.props | 2 +- .../MiniPrograms/Login/LoginController.cs | 3 +-- .../WeChatThirdPartyPlatformController.cs | 12 +++++++++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 17d7716a..97a238ed 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ 6.0.1 1.2.3 - 2.0.0-rc.20 + 2.0.0-rc.21 \ No newline at end of file diff --git a/common.props b/common.props index 49450908..53be0011 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ latest - 2.0.0-rc.20 + 2.0.0-rc.21 $(NoWarn);CS1591 true EasyAbp Team diff --git a/modules/MiniPrograms/src/EasyAbp.WeChatManagement.MiniPrograms.HttpApi/EasyAbp/WeChatManagement/MiniPrograms/Login/LoginController.cs b/modules/MiniPrograms/src/EasyAbp.WeChatManagement.MiniPrograms.HttpApi/EasyAbp/WeChatManagement/MiniPrograms/Login/LoginController.cs index b690a56b..7390c2a7 100644 --- a/modules/MiniPrograms/src/EasyAbp.WeChatManagement.MiniPrograms.HttpApi/EasyAbp/WeChatManagement/MiniPrograms/Login/LoginController.cs +++ b/modules/MiniPrograms/src/EasyAbp.WeChatManagement.MiniPrograms.HttpApi/EasyAbp/WeChatManagement/MiniPrograms/Login/LoginController.cs @@ -32,8 +32,7 @@ public Task RefreshAsync(RefreshInput input) } [HttpGet] - [Route("pc-login-acode")] - [Route("pc-login-acode/{miniProgramName}")] + [Route("pc-login-acode/{miniProgramName?}")] public Task GetPcLoginACodeAsync(string miniProgramName, string handlePage = null) { return _service.GetPcLoginACodeAsync(miniProgramName, handlePage); diff --git a/modules/ThirdPartyPlatforms/src/EasyAbp.WeChatManagement.ThirdPartyPlatforms.HttpApi/EasyAbp/WeChatManagement/ThirdPartyPlatforms/Controllers/WeChatThirdPartyPlatformController.cs b/modules/ThirdPartyPlatforms/src/EasyAbp.WeChatManagement.ThirdPartyPlatforms.HttpApi/EasyAbp/WeChatManagement/ThirdPartyPlatforms/Controllers/WeChatThirdPartyPlatformController.cs index bab83f30..206dae04 100644 --- a/modules/ThirdPartyPlatforms/src/EasyAbp.WeChatManagement.ThirdPartyPlatforms.HttpApi/EasyAbp/WeChatManagement/ThirdPartyPlatforms/Controllers/WeChatThirdPartyPlatformController.cs +++ b/modules/ThirdPartyPlatforms/src/EasyAbp.WeChatManagement.ThirdPartyPlatforms.HttpApi/EasyAbp/WeChatManagement/ThirdPartyPlatforms/Controllers/WeChatThirdPartyPlatformController.cs @@ -33,7 +33,6 @@ public WeChatThirdPartyPlatformController( /// [HttpGet] [Route("auth-callback/token/{token}")] - [Route("auth-callback/tenant-id/{tenantId}/token/{token}")] public virtual async Task AuthCallbackAsync(string tenantId, string token) { using var changeTenant = CurrentTenant.Change(tenantId.IsNullOrWhiteSpace() ? null : Guid.Parse(tenantId)); @@ -53,4 +52,15 @@ await AuthorizationAppService.HandleCallbackAsync(new HandleCallbackInputDto( return await AuthCallbackActionResultProvider.GetAsync(result); } + + /// + /// 本方法是为了避免多 Route 导致 ABP ApiDescription 报 Warning。 + /// 见 + /// + [HttpGet] + [Route("auth-callback/tenant-id/{tenantId}/token/{token}")] + public virtual Task AuthCallback2Async(string tenantId, string token) + { + return AuthCallbackAsync(tenantId, token); + } } \ No newline at end of file