提交管理员操作一切

This commit is contained in:
chfei committed 2026-10-23 18:16:05 +08:00
1 parent a87ebeaffb
commit d6471f97d3
23 files changed
+600 -73

No files matched your search

+4
View File
@@ -32,6 +32,7 @@ namespace Store.Api.Controllers
/// 登录:校验用户名/密码,签发 JWT(单点登录:同用户的新登录会使旧令牌失效)
/// </summary>
[HttpPost]
[EndpointSummary("用户登录")]
[AllowAnonymous]
public async Task<ApiResultBase> Login([FromBody] LoginRequest request)
{
@@ -58,6 +59,7 @@ namespace Store.Api.Controllers
/// 退出登录:销毁当前用户的服务端在线会话,令牌立即失效
/// </summary>
[HttpPost]
[EndpointSummary("退出登录")]
[Authorize]
public ApiResult<object?> Logout()
{
@@ -73,6 +75,7 @@ namespace Store.Api.Controllers
/// 获取当前登录用户信息(需携带 Bearer Token)
/// </summary>
[HttpGet]
[EndpointSummary("获取当前登录用户信息")]
[Authorize]
public ApiResult<object?> Me()
{
@@ -87,6 +90,7 @@ namespace Store.Api.Controllers
/// 在线人员列表(需携带 Bearer Token)
/// </summary>
[HttpGet]
[EndpointSummary("获取在线人员列表")]
[Authorize]
public ApiResult<object?> OnlineUsers()
{
+13
View File
@@ -1,4 +1,5 @@
using Asp.Versioning;
using Asp.Versioning.OpenApi;
using MAX.Framework.Conventions;
using MAX.Framework.DependencyInjection;
using Scalar.AspNetCore;
@@ -39,6 +40,18 @@ public partial class Program
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
}).AddOpenApi();
builder.Services.Configure<VersionedOpenApiOptions>(options =>
{
options.Document.AddDocumentTransformer((document, _, _) =>
{
// 接口路径以 / 开头,服务器地址不保留尾部斜杠,兼容导入工具直接拼接 URL。
foreach (var server in document.Servers ?? [])
{
server.Url = server.Url?.TrimEnd('/');
}
return Task.CompletedTask;
});
});
WebApplication app = builder.Build();
+7
View File
@@ -1,4 +1,11 @@
{
"Jwt": {
"DevelopmentToken": {
"Enabled": true,
"Token": "store-local-dev-7f2c9e4a6b814d38a5910e62c4f837bd",
"UserName": "18990991234"
}
},
"Logging": {
"LogLevel": {
"Default": "Information",