diff --git a/Controllers/SimApiAuthController.cs b/Controllers/SimApiAuthController.cs
index e13f563..100bb03 100644
--- a/Controllers/SimApiAuthController.cs
+++ b/Controllers/SimApiAuthController.cs
@@ -9,13 +9,6 @@ using static SimApiError;
public class SimApiAuthController(SimApiAuth auth) : SimApiBaseController
{
- ///
- /// 获取已登录用户信息
- ///
- ///
- [HttpPost, SimApiAuth, SimApiDoc("认证", "获取已登录用户信息")]
- public SimApiLoginItem UserInfo() => LoginInfo;
-
///
/// 退出登陆
///
diff --git a/Controllers/SimApiCommonController.cs b/Controllers/SimApiCommonController.cs
index 92bcc41..9390363 100644
--- a/Controllers/SimApiCommonController.cs
+++ b/Controllers/SimApiCommonController.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using SimApi.Attributes;
+using SimApi.Communications;
using SimApi.Helpers;
using static SimApi.Helpers.SimApiError;
@@ -17,7 +18,7 @@ public class SimApiCommonController : SimApiBaseController
[ApiExplorerSettings(IgnoreApi = true)]
public void ExceptionHandler(int code)
{
- SimApiError.Error(code);
+ Error(code);
}
@@ -32,13 +33,9 @@ public class SimApiCommonController : SimApiBaseController
}
///
- /// 检测用户登陆的控制器
+ /// 获取已登录用户信息
///
///
- [HttpPost, SimApiAuth, SimApiDoc("认证", "检测登陆")]
- public string CheckLogin()
- {
- ErrorWhenNull(LoginInfo, 401, "未登录");
- return LoginInfo.Id;
- }
+ [HttpPost("/user/info"), SimApiAuth, SimApiDoc("认证", "获取已登录用户信息")]
+ public SimApiLoginItem UserInfo() => LoginInfo;
}
\ No newline at end of file
diff --git a/SimApiExtensions.cs b/SimApiExtensions.cs
index 8f3bc3b..3d485ed 100644
--- a/SimApiExtensions.cs
+++ b/SimApiExtensions.cs
@@ -426,23 +426,10 @@ public static class SimApiExtensions
}
}
- builder.MapControllerRoute(name: "CheckLogin", pattern: "/auth/check",
- defaults: new
- {
- controller = "SimApiCommon",
- action = "CheckLogin"
- });
if (options.EnableSimApiAuth)
{
logger.LogInformation("开始配置SimApiAuth...");
builder.UseMiddleware();
- builder.MapControllerRoute(name: "GetUserInfo", pattern: "/user/info",
- defaults: new
- {
- controller = "SimApiAuth",
- action = "UserInfo"
- });
-
builder.MapControllerRoute(name: "Logout", pattern: "/auth/logout",
defaults: new
{