|
@@ -1,33 +1,30 @@
|
|
|
-//using Admin.NET.Core;
|
|
|
|
|
-//using Microsoft.OpenApi.Models;
|
|
|
|
|
-//using Swashbuckle.AspNetCore.SwaggerGen;
|
|
|
|
|
-//using System;
|
|
|
|
|
-//using System.Collections.Generic;
|
|
|
|
|
-//using System.Linq;
|
|
|
|
|
-//using System.Text;
|
|
|
|
|
-//using System.Threading.Tasks;
|
|
|
|
|
|
|
+using Microsoft.OpenApi;
|
|
|
|
|
+using Swashbuckle.AspNetCore.SwaggerGen;
|
|
|
|
|
|
|
|
-//namespace Admin.NET.Core;
|
|
|
|
|
|
|
+namespace Admin.NET.Core;
|
|
|
|
|
|
|
|
-///// <summary>
|
|
|
|
|
-///// 租户头部参数过滤器
|
|
|
|
|
-///// </summary>
|
|
|
|
|
-//public class TenantHeaderOperationFilter : IOperationFilter
|
|
|
|
|
-//{
|
|
|
|
|
-// /// <summary>
|
|
|
|
|
-// /// 应用租户头部参数过滤器
|
|
|
|
|
-// /// </summary>
|
|
|
|
|
-// public void Apply(OpenApiOperation operation, OperationFilterContext context)
|
|
|
|
|
-// {
|
|
|
|
|
-// operation.Parameters ??= new List<OpenApiParameter>();
|
|
|
|
|
|
|
+/// <summary>
|
|
|
|
|
+/// 租户头部参数过滤器
|
|
|
|
|
+/// </summary>
|
|
|
|
|
+public class TenantHeaderOperationFilter : IOperationFilter
|
|
|
|
|
+{
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 应用租户头部参数过滤器
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ public void Apply(OpenApiOperation operation, OperationFilterContext context)
|
|
|
|
|
+ {
|
|
|
|
|
+ operation.Parameters ??= [];
|
|
|
|
|
|
|
|
-// operation.Parameters.Add(new OpenApiParameter
|
|
|
|
|
-// {
|
|
|
|
|
-// Name = ClaimConst.TenantId,
|
|
|
|
|
-// In = ParameterLocation.Header,
|
|
|
|
|
-// Required = false,
|
|
|
|
|
-// AllowEmptyValue = true,
|
|
|
|
|
-// Description = "租户ID(留空表示默认租户)"
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
-//}
|
|
|
|
|
|
|
+ operation.Parameters.Add(new OpenApiParameter
|
|
|
|
|
+ {
|
|
|
|
|
+ Name = ClaimConst.TenantId,
|
|
|
|
|
+ In = ParameterLocation.Header,
|
|
|
|
|
+ Schema = new OpenApiSchema { Type = JsonSchemaType.String },
|
|
|
|
|
+ Required = false,
|
|
|
|
|
+ AllowEmptyValue = true,
|
|
|
|
|
+ Description = "租户ID(留空表示默认租户)"
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+}
|