|
|
@ -52,6 +52,9 @@ using Microsoft.AspNetCore.Diagnostics; |
|
|
using Microsoft.AspNetCore.Http; |
|
|
using Microsoft.AspNetCore.Http; |
|
|
using Shentun.Peis.Filter; |
|
|
using Shentun.Peis.Filter; |
|
|
using Shentun.Peis.VirtualPath; |
|
|
using Shentun.Peis.VirtualPath; |
|
|
|
|
|
using System.Text.Encodings.Web; |
|
|
|
|
|
using System.Text.Unicode; |
|
|
|
|
|
using Volo.Abp.Json; |
|
|
|
|
|
|
|
|
namespace Shentun.Peis; |
|
|
namespace Shentun.Peis; |
|
|
[DependsOn( |
|
|
[DependsOn( |
|
|
@ -104,7 +107,7 @@ public class PeisHttpApiHostModule : AbpModule |
|
|
ConfigureCors(context, configuration); |
|
|
ConfigureCors(context, configuration); |
|
|
ConfigureSwaggerServices(context, configuration); |
|
|
ConfigureSwaggerServices(context, configuration); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConfigureJsonOptions(); //全局配置api返回值中的日期默认格式
|
|
|
|
|
|
|
|
|
//密码策略配置
|
|
|
//密码策略配置
|
|
|
context.Services.Configure<IdentityOptions>(opt => |
|
|
context.Services.Configure<IdentityOptions>(opt => |
|
|
@ -178,6 +181,31 @@ public class PeisHttpApiHostModule : AbpModule |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 全局转换日期格式
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void ConfigureJsonOptions() |
|
|
|
|
|
{ |
|
|
|
|
|
//context.Services.AddControllers().AddJsonOptions(options =>
|
|
|
|
|
|
//{
|
|
|
|
|
|
// options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All);
|
|
|
|
|
|
// options.JsonSerializerOptions.PropertyNamingPolicy = null;
|
|
|
|
|
|
//});
|
|
|
|
|
|
Configure<JsonOptions>(x => |
|
|
|
|
|
{ |
|
|
|
|
|
x.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); |
|
|
|
|
|
x.JsonSerializerOptions.PropertyNamingPolicy = null; |
|
|
|
|
|
x.JsonSerializerOptions.Converters.Add(new JsonTimeSpanConverter()); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Configure<AbpJsonOptions>(x => |
|
|
|
|
|
{ |
|
|
|
|
|
x.DefaultDateTimeFormat = "yyyy-MM-dd HH:mm:ss"; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void ConfigureAuthentication(ServiceConfigurationContext context) |
|
|
private void ConfigureAuthentication(ServiceConfigurationContext context) |
|
|
{ |
|
|
{ |
|
|
context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme); |
|
|
context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme); |
|
|
|