修改User模块,同步原始代码

This commit is contained in:
chfei committed 2026-10-23 15:42:37 +08:00
1 parent 4a5fada435
commit 78b0c2bb2e
47 files changed
+2939 -193

No files matched your search

+10 -4
View File
@@ -1,4 +1,5 @@
using Asp.Versioning;
using MAX.Framework.Conventions;
using MAX.Framework.DependencyInjection;
using Scalar.AspNetCore;
@@ -21,16 +22,21 @@ public partial class Program
// // 兼容迁移的同步控制器:允许同步读写请求/响应 IO(旧 asmx 行为)
// options.AllowSynchronousIO = true;
//});
builder.Services.AddControllers();
builder.Services.AddControllers(options =>
{
options.Conventions.Add(new ApiRoutePrefixConvention());
});
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddApiVersioning(options =>
{
options.DefaultApiVersion = new ApiVersion(1, 0);
options.AssumeDefaultVersionWhenUnspecified = true;// 未指定时使用默认版本
options.ReportApiVersions = true;
options.ApiVersionReader = new UrlSegmentApiVersionReader();
}).AddMvc().AddApiExplorer(options =>
{
options.GroupNameFormat = "'v'V";
// 保留次版本号,避免 1.0 与 1.1 都映射为 v1,造成 OpenAPI 服务重复注册。
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
}).AddOpenApi();
@@ -49,8 +55,8 @@ public partial class Program
app.MapScalarApiReference(options =>
{
options.DefaultHttpClient = new(ScalarTarget.CSharp, ScalarClient.HttpClient);
options.Title = "商铺管理API V1";
options.AddDocuments(new[] { "v1", "v2" });
options.Title = "商铺管理API";
options.AddDocuments(app.DescribeApiVersions().Select(version => version.GroupName).ToArray());
});
}