v3.4.6
This commit is contained in:
@@ -4,15 +4,88 @@
|
||||
//系统文件路径
|
||||
"SystemPath": "D:\\ToTong\\tnb\\Resources",
|
||||
//微信公众号允许上传文件类型
|
||||
"MPUploadFileType": [ "bmp", "png", "jpeg", "jpg", "gif", "mp3", "wma", "wav", "amr", "mp4" ],
|
||||
"MPUploadFileType": [
|
||||
"bmp",
|
||||
"png",
|
||||
"jpeg",
|
||||
"jpg",
|
||||
"gif",
|
||||
"mp3",
|
||||
"wma",
|
||||
"wav",
|
||||
"amr",
|
||||
"mp4"
|
||||
],
|
||||
//微信允许上传文件类型
|
||||
"WeChatUploadFileType": [ "jpg", "png", "doc", "docx", "ppt", "pptx", "xls", "xlsx", "pdf", "txt", "rar", "zip", "csv", "amr", "mp4" ],
|
||||
"WeChatUploadFileType": [
|
||||
"jpg",
|
||||
"png",
|
||||
"doc",
|
||||
"docx",
|
||||
"ppt",
|
||||
"pptx",
|
||||
"xls",
|
||||
"xlsx",
|
||||
"pdf",
|
||||
"txt",
|
||||
"rar",
|
||||
"zip",
|
||||
"csv",
|
||||
"amr",
|
||||
"mp4"
|
||||
],
|
||||
//允许图片类型
|
||||
"AllowUploadImageType": [ "jpg", "gif", "png", "bmp", "jpeg", "tiff", "psd", "swf", "svg", "pcx", "dxf", "wmf", "emf", "lic", "eps", "tga" ],
|
||||
"AllowUploadImageType": [
|
||||
"jpg",
|
||||
"gif",
|
||||
"png",
|
||||
"bmp",
|
||||
"jpeg",
|
||||
"tiff",
|
||||
"psd",
|
||||
"swf",
|
||||
"svg",
|
||||
"pcx",
|
||||
"dxf",
|
||||
"wmf",
|
||||
"emf",
|
||||
"lic",
|
||||
"eps",
|
||||
"tga"
|
||||
],
|
||||
//允许上传文件类型
|
||||
"AllowUploadFileType": [ "jpg", "mp3", "gif", "png", "bmp", "jpeg", "doc", "docx", "ppt", "pptx", "xls", "xlsx", "pdf", "txt", "rar", "zip", "csv" ],
|
||||
"AllowUploadFileType": [
|
||||
"jpg",
|
||||
"mp3",
|
||||
"gif",
|
||||
"png",
|
||||
"bmp",
|
||||
"jpeg",
|
||||
"doc",
|
||||
"docx",
|
||||
"ppt",
|
||||
"pptx",
|
||||
"xls",
|
||||
"xlsx",
|
||||
"pdf",
|
||||
"txt",
|
||||
"rar",
|
||||
"zip",
|
||||
"csv"
|
||||
],
|
||||
//过滤上传文件名称特殊字符
|
||||
"SpecialString": [ "/", "<", ">", "|", "?", "\\", ":", "\"", "*", "_" ],
|
||||
"SpecialString": [
|
||||
"/",
|
||||
"<",
|
||||
">",
|
||||
"|",
|
||||
"?",
|
||||
"\\",
|
||||
":",
|
||||
"\"",
|
||||
"*",
|
||||
"_"
|
||||
],
|
||||
"PreviewType": "kkfile", //文件预览方式 (kkfile,yozo)默认使用kkfile
|
||||
"KKFileDomain": "http://127.0.0.1:30090/FileServer",
|
||||
"Domain": "http://yinmai.tpddns.cn:7772",
|
||||
@@ -21,18 +94,52 @@
|
||||
"domainKey": "57462250284462899305150",
|
||||
"UploadAPI": "http://dmc.yozocloud.cn/api/file/http?fileUrl={0}&appId={1}&sign={2}", //上传接口
|
||||
"DownloadAPI": "http://eic.yozocloud.cn/api/view/file?fileVersionId={0}&appId={1}&sign={2}", //预览接口
|
||||
"AppId": "yozoAQh5dPSt6063", //应用Id
|
||||
"AppKey": "6365bfbd733fce644fd7ac0aaeca" //签名
|
||||
"AppId": "yozoAQh5dPSt6063", // 应用Id
|
||||
"AppKey": "6365bfbd733fce644fd7ac0aaeca" // 签名
|
||||
},
|
||||
//================== 系统错误邮件报告反馈相关 ============================== -->
|
||||
//软件的错误报告
|
||||
// ================== 系统错误邮件报告反馈相关 ============================== -->
|
||||
// 软件的错误报告
|
||||
"ErrorReport": false,
|
||||
//软件的错误报告发给谁
|
||||
"ErrorReportTo": "tuotong_tech@163.com"
|
||||
},
|
||||
// ================== 单点登录配置(和其他登录方式 只能二选一) ============================== -->
|
||||
"OAuth": {
|
||||
"Enabled": false, // 开启后将支持单点登录, 前端与后端都不可使用普通模式登录
|
||||
"LoginPath": "http://192.168.20.119:5000/api/oauth/Login", // 前端登录页面访问登录接口进行单点登录页面跳转, 需要与身份管理系统中的 JNPF-Auth2、JNPF-CAS中的认证地址一致
|
||||
"SucessFrontUrl": "http://192.168.20.119:3000/sso", // 从单点登录中心直接访问JNPF时登录成功后跳转的前端页面
|
||||
"DefaultSSO": "auth2", // 默认接口
|
||||
"TicketTimeout": 5, // 缓存过期时间 / 分钟
|
||||
"TicketOutMessage": false, // 是否前端输出消息
|
||||
"SSO": {
|
||||
"auth2": {
|
||||
"enabled": true,
|
||||
"clientId": "747887288041603072",
|
||||
"clientSecret": "MYgMMjIwNzIwMjIxNTU4MTAxNzQlKQ",
|
||||
"authorizeUrl": "https://192.168.20.133:8527/sign/authz/oauth/v20/authorize",
|
||||
"accessTokenUrl": "https://192.168.20.133:8527/sign/authz/oauth/v20/token",
|
||||
"userInfoUrl": "https://192.168.20.133:8527/sign/api/oauth/v20/me"
|
||||
},
|
||||
"cas": {
|
||||
"enabled": true,
|
||||
"serverLoginUrl": "https://sso.test.jnpf.work/sign/authz/cas/login",
|
||||
"serverValidateUrl": "https://sso.test.jnpf.work/sign/authz/cas"
|
||||
}
|
||||
},
|
||||
"Pull": {
|
||||
"Enabled": true,
|
||||
"CreateRestAddress": "http://192.168.20.133:9526/sso-mgt-api/api/idm/Account",
|
||||
"ReplaceRestAddress": "http://192.168.20.133:9526/sso-mgt-api/api/idm/Account",
|
||||
"ChangePasswordRestAddress": "http://192.168.20.133:9526/sso-mgt-api/api/idm/Account/changePassword",
|
||||
"DeleteRestAddress": "http://192.168.20.133:9526/sso-mgt-api/api/idm/Account",
|
||||
"CredentialType": "Basic",
|
||||
"UserName": "747887288041603072",
|
||||
"Password": "MYgMMjIwNzIwMjIxNTU4MTAxNzQlKQ"
|
||||
}
|
||||
},
|
||||
//================== 第三方登录配置 ============================== -->
|
||||
"Socials": {
|
||||
"SocialsEnabled": true,
|
||||
"SocialsEnabled": false,
|
||||
"DoMain": "https://562f45p309.goho.co/dev", // 外网能访问的地址(域名), 回调的时候拼接接口地址用
|
||||
"Config": [
|
||||
{
|
||||
@@ -76,8 +183,9 @@
|
||||
},
|
||||
//================== 消息跳转配置 ============================== -->
|
||||
"Message": {
|
||||
"DoMainPc": "http://127.0.0.1:3000", // 前端PC外网能访问的地址(域名), 回调的时候拼接接口地址用
|
||||
"DoMainApp": "http://127.0.0.1:3000", // 前端App外网能访问的地址(域名), 回调的时候拼接接口地址用
|
||||
"ApiDoMain": "http://localhost:5000", // 后端Api路径 (发布时与DoMainPc一致)
|
||||
"DoMainPc": "http://localhost:3000", // 前端PC外网能访问的地址(域名), 回调的时候拼接接口地址用
|
||||
"DoMainApp": "http://localhost:8081", // 前端App外网能访问的地址(域名), 回调的时候拼接接口地址用
|
||||
"AppPushUrl": "https://8e84eea8-6922-4033-8e86-67ad7442e692.bspapp.com/unipush"
|
||||
}
|
||||
}
|
||||
8
apihost/Tnb.API.Entry/Configurations/EventBus.json
Normal file
8
apihost/Tnb.API.Entry/Configurations/EventBus.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"EventBus": {
|
||||
"EventBusType": "Memory", //Memory,RabbitMQ
|
||||
"HostName": "192.168.0.232",
|
||||
"UserName": "jnpf",
|
||||
"Password": "jnpf@2019"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"JWTSettings": {
|
||||
"ValidateIssuerSigningKey": true, // 是否验证密钥,bool 类型,默认true
|
||||
"IssuerSigningKey": "7k5yOxSMHVdYjs61gkgUY3W9DHbgk7tokaZlP3QIlfk34D1H7jYEOcLybClW1aKl", // 密钥,string 类型,必须是复杂密钥,长度大于16
|
||||
"IssuerSigningKey": "RkayGi4ltkMWrSQKsQTWic1VnakqsQfaJOmJIBUWE1gxGaS0IrJHxa9anjVAwuew", // 密钥,string 类型,必须是复杂密钥,长度大于16
|
||||
"ValidateIssuer": true, // 是否验证签发方,bool 类型,默认true
|
||||
"ValidIssuer": "tuotong", // 签发方,string 类型
|
||||
"ValidateAudience": true, // 是否验证签收方,bool 类型,默认true
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"JobConnectionStrings": {
|
||||
"ConfigId": "JNPF-Job",// 不可修改
|
||||
"DBName": "jnpf_sundial",
|
||||
"DBType": "SqlServer", //MySql;SqlServer;Oracle;PostgreSQL;Dm;Kdbndp;Sqlite;
|
||||
"Host": "192.168.0.214",
|
||||
"Port": "1433",
|
||||
"UserName": "sa",
|
||||
"Password": "kMaeMP8Yck6b6wA",
|
||||
//SqlServer
|
||||
"DefaultConnection": "Data Source=192.168.0.214;Initial Catalog={0};User ID=sa;Password=kMaeMP8Yck6b6wA;MultipleActiveResultSets=true"
|
||||
//Kdbndp
|
||||
//"DefaultConnection": "Server=192.168.0.103;Port=54321;UID=YANYU;PWD=123456;database=YANSOURCE"
|
||||
//Dm
|
||||
//"DefaultConnection": "Server=192.168.0.50; User Id=JNPFTEST; PWD=I97eH!bRfy55qGzF;DATABASE=JNPFTEST"
|
||||
//Oracle
|
||||
//"DefaultConnection": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.19)(PORT=1521))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME=JNPFCLOUD)));User Id=JNPFCLOUD;Password=JNPFCLOUD"
|
||||
//PostgreSQL
|
||||
//"DefaultConnection": "PORT=5432;DATABASE=java_boot_dev_postgresql;HOST=192.168.0.103;PASSWORD=123456;USER ID=postgres"
|
||||
//MySql
|
||||
//"DefaultConnection": "server=192.168.0.10;Database=netcore_test;Uid=netcore_test;Pwd=jhpGB3A88CF57fBC;AllowLoadLocalInfile=true"
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
"Group": "Default",
|
||||
"Title": "ToTong Next Builder",
|
||||
"Description": "",
|
||||
"Version": "3.4.5"
|
||||
"Version": "3.4.6"
|
||||
}
|
||||
],
|
||||
"LoginInfo": {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using JNPF;
|
||||
using JNPF.Common.Core;
|
||||
using JNPF.Common.Options;
|
||||
using JNPF.EventHandler;
|
||||
using OnceMi.AspNetCore.OSS;
|
||||
@@ -17,40 +18,53 @@ public static class ConfigureEventBusExtensions
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection ConfigureEventBus(this IServiceCollection services)
|
||||
{
|
||||
// 注册EventBus服务
|
||||
services.AddEventBus(options =>
|
||||
{
|
||||
//// 创建连接工厂
|
||||
//var factory = new RabbitMQ.Client.ConnectionFactory
|
||||
//{
|
||||
// // 设置主机名
|
||||
// HostName = "192.168.0.232",
|
||||
// 注册EventBus服务
|
||||
// 注册EventBus服务
|
||||
services.AddEventBus(options =>
|
||||
{
|
||||
var config = App.GetOptions<EventBusOptions>();
|
||||
|
||||
// // 用户名
|
||||
// UserName = "jnpf",
|
||||
if (config.EventBusType != EventBusType.Memory)
|
||||
{
|
||||
switch (config.EventBusType)
|
||||
{
|
||||
case EventBusType.RabbitMQ:
|
||||
// 创建连接工厂
|
||||
var factory = new RabbitMQ.Client.ConnectionFactory
|
||||
{
|
||||
// 设置主机名
|
||||
HostName = config.HostName,
|
||||
|
||||
// // 密码
|
||||
// Password = "jnpf@2019",
|
||||
//};
|
||||
// 用户名
|
||||
UserName = config.UserName,
|
||||
|
||||
//// 创建默认内存通道事件源对象,可自定义队列路由key,比如这里是 eventbus
|
||||
//var rbmqEventSourceStorer = new RabbitMQEventSourceStorer(factory, "eventbus", 3000);
|
||||
// 密码
|
||||
Password = config.Password,
|
||||
};
|
||||
|
||||
//// 替换默认事件总线存储器
|
||||
//options.ReplaceStorer(serviceProvider =>
|
||||
//{
|
||||
// return rbmqEventSourceStorer;
|
||||
//});
|
||||
// 创建默认内存通道事件源对象,可自定义队列路由key,比如这里是 eventbus
|
||||
var rbmqEventSourceStorer = new RabbitMQEventSourceStorer(factory, "eventbus", 3000);
|
||||
|
||||
options.UseUtcTimestamp = false;
|
||||
// 替换默认事件总线存储器
|
||||
options.ReplaceStorer(serviceProvider =>
|
||||
{
|
||||
return rbmqEventSourceStorer;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 不启用事件日志
|
||||
options.LogEnabled = false;
|
||||
options.UseUtcTimestamp = false;
|
||||
|
||||
// 事件执行器(失败重试)
|
||||
options.AddExecutor<RetryEventHandlerExecutor>();
|
||||
});
|
||||
// 不启用事件日志
|
||||
options.LogEnabled = false;
|
||||
|
||||
return services;
|
||||
// 事件执行器(失败重试)
|
||||
options.AddExecutor<RetryEventHandlerExecutor>();
|
||||
});
|
||||
|
||||
services.AddConfigurableOptions<EventBusOptions>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ using Newtonsoft.Json;
|
||||
using OnceMi.AspNetCore.OSS;
|
||||
using JNPF.API.Entry.Handlers;
|
||||
using JNPF.Common.Cache;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
@@ -18,60 +19,108 @@ namespace Microsoft.Extensions.DependencyInjection;
|
||||
/// </summary>
|
||||
public static class ConfigureMvcControllerExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// OSS服务配置.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection ConfigureMvcController(this IServiceCollection services)
|
||||
{
|
||||
services.AddControllers()
|
||||
.AddMvcFilter<RequestActionFilter>()
|
||||
.AddInjectWithUnifyResult<RESTfulResultProvider>()
|
||||
.AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null)
|
||||
.AddNewtonsoftJson(options =>
|
||||
/// <summary>
|
||||
/// OSS服务配置.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection ConfigureMvcController(this IServiceCollection services)
|
||||
{
|
||||
services.AddControllers()
|
||||
.AddMvcFilter<RequestActionFilter>()
|
||||
.AddInjectWithUnifyResult<RESTfulResultProvider>()
|
||||
.AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null)
|
||||
.AddNewtonsoftJson(options =>
|
||||
{
|
||||
// 默认命名规则
|
||||
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
|
||||
|
||||
// 设置时区为 UTC
|
||||
options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
|
||||
|
||||
// 格式化json输出的日期格式
|
||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
// 忽略空值
|
||||
// options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
|
||||
|
||||
// 忽略循环引用
|
||||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||
|
||||
// 格式化json输出的日期格式为时间戳
|
||||
options.SerializerSettings.Converters.Add(new NewtonsoftDateTimeJsonConverter());
|
||||
});
|
||||
|
||||
services.AddUnifyJsonOptions("special", new JsonSerializerSettings
|
||||
{
|
||||
// 默认命名规则
|
||||
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
|
||||
// 默认命名规则
|
||||
ContractResolver = new DefaultContractResolver(),
|
||||
|
||||
// 设置时区为 UTC
|
||||
options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
|
||||
// 设置时区为 UTC
|
||||
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
|
||||
|
||||
// 格式化json输出的日期格式
|
||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
// 忽略空值
|
||||
// options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
|
||||
|
||||
// 忽略循环引用
|
||||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||
|
||||
// 格式化json输出的日期格式为时间戳
|
||||
options.SerializerSettings.Converters.Add(new NewtonsoftDateTimeJsonConverter());
|
||||
// 格式化json输出的日期格式
|
||||
DateFormatString = "yyyy-MM-dd HH:mm:ss",
|
||||
});
|
||||
|
||||
// 配置Nginx转发获取客户端真实IP
|
||||
// 注1:如果负载均衡不是在本机通过 Loopback 地址转发请求的,一定要加上options.KnownNetworks.Clear()和options.KnownProxies.Clear()
|
||||
// 注2:如果设置环境变量 ASPNETCORE_FORWARDEDHEADERS_ENABLED 为 True,则不需要下面的配置代码
|
||||
services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders = ForwardedHeaders.All;
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
});
|
||||
// 配置Nginx转发获取客户端真实IP
|
||||
// 注1:如果负载均衡不是在本机通过 Loopback 地址转发请求的,一定要加上options.KnownNetworks.Clear()和options.KnownProxies.Clear()
|
||||
// 注2:如果设置环境变量 ASPNETCORE_FORWARDEDHEADERS_ENABLED 为 True,则不需要下面的配置代码
|
||||
services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders = ForwardedHeaders.All;
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
});
|
||||
|
||||
// Jwt处理程序
|
||||
services.AddJwt<JwtHandler>(enableGlobalAuthorize: true);
|
||||
// Jwt处理程序
|
||||
services.AddJwt<JwtHandler>(enableGlobalAuthorize: true, jwtBearerConfigure: options =>
|
||||
{
|
||||
// 实现 JWT 身份验证过程控制
|
||||
options.Events = new JwtBearerEvents
|
||||
{
|
||||
// 添加读取 Token 的方式
|
||||
OnMessageReceived = context =>
|
||||
{
|
||||
var httpContext = context.HttpContext;
|
||||
|
||||
// 跨域
|
||||
services.AddCorsAccessor();
|
||||
// 判断请求是否包含 token 参数,如果有就设置给 Token
|
||||
if (httpContext.Request.Query.ContainsKey("token"))
|
||||
{
|
||||
// 设置 Token
|
||||
context.Token = httpContext.Request.Query["token"];
|
||||
}
|
||||
|
||||
services.AddConfigurableOptions<CacheOptions>();
|
||||
services.AddSession();
|
||||
services.AddMemoryCache(); // 使用本地缓存必须添加
|
||||
return Task.CompletedTask;
|
||||
},
|
||||
|
||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
// Token 验证通过处理
|
||||
OnTokenValidated = context =>
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
// 跨域
|
||||
services.AddCorsAccessor();
|
||||
|
||||
// 注册远程请求
|
||||
services.AddRemoteRequest();
|
||||
|
||||
// 视图引擎
|
||||
services.AddViewEngine();
|
||||
|
||||
// 脱敏词汇检测
|
||||
services.AddSensitiveDetection();
|
||||
|
||||
// WebSocket服务
|
||||
services.AddWebSocketManager();
|
||||
|
||||
services.AddSession();
|
||||
|
||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public static class ConfigureSqlSugarExtensions
|
||||
// 默认数据库
|
||||
connectConfigList.Add(new ConnectionConfig
|
||||
{
|
||||
ConnectionString = string.Format(conn.DefaultConnection, conn.Host, conn.Port, conn.DBName, conn.UserName, conn.Password),
|
||||
ConnectionString = conn.ConnectString,
|
||||
DbType = DBType,
|
||||
IsAutoCloseConnection = true,
|
||||
ConfigId = conn.ConfigId,
|
||||
@@ -62,10 +62,9 @@ public static class ConfigureSqlSugarExtensions
|
||||
//};
|
||||
});
|
||||
});
|
||||
services.AddUnitOfWork<SqlSugarUnitOfWork>();
|
||||
services.AddConfigurableOptions<ConnectionStringsOptions>();
|
||||
services.AddConfigurableOptions<TenantOptions>();
|
||||
services.AddUnitOfWork<SqlSugarUnitOfWork>();
|
||||
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -7,15 +7,15 @@ public class WebComponent : IWebComponent
|
||||
{
|
||||
public void Load(WebApplicationBuilder builder, ComponentContext componentContext)
|
||||
{
|
||||
//// <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
|
||||
builder.Host.UseWindowsService();
|
||||
//// 日志过滤
|
||||
//builder.Logging.AddFilter((provider, category, logLevel) =>
|
||||
//{
|
||||
// return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u)) && logLevel >= LogLevel.Information;
|
||||
//});
|
||||
builder.Host.UseWindowsService();
|
||||
builder.WebHost.ConfigureKestrel(options =>
|
||||
{
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> null
|
||||
// 长度最好不要设置 null
|
||||
options.Limits.MaxRequestBodySize = 52428800;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using IGeekFan.AspNetCore.Knife4jUI;
|
||||
using JNPF.API.Entry.Handlers;
|
||||
using JNPF.Common.Cache;
|
||||
using JNPF.Common.Core;
|
||||
using JNPF.Common.Core.Filter;
|
||||
using JNPF.Common.Core.Handlers;
|
||||
using JNPF.Common.Security;
|
||||
@@ -26,87 +27,88 @@ namespace JNPF.API.Entry;
|
||||
|
||||
public class Startup : AppStartup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.ConfigureMvcController();
|
||||
|
||||
// SqlSugar
|
||||
//services.SqlSugarConfigure();
|
||||
services.ConfigureSqlSugar();
|
||||
|
||||
// 注册EventBus服务
|
||||
services.ConfigureEventBus();
|
||||
|
||||
// 注册远程请求
|
||||
services.AddRemoteRequest();
|
||||
|
||||
// 视图引擎
|
||||
services.AddViewEngine();
|
||||
|
||||
// 任务调度
|
||||
services.AddTaskScheduler();
|
||||
|
||||
// 脱敏词汇检测
|
||||
services.AddSensitiveDetection();
|
||||
|
||||
// WebSocket服务
|
||||
services.AddWebSocketManager();
|
||||
|
||||
// 微信
|
||||
services.AddSenparcGlobalServices(App.Configuration) // Senparc.CO2NET 全局注册
|
||||
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
||||
|
||||
services.ConfigureLogging();
|
||||
services.ConfigureOSSService();
|
||||
|
||||
services.AddSchedule();
|
||||
|
||||
services.AddOverideVisualDev();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
||||
{
|
||||
// 添加状态码拦截中间件
|
||||
app.UseUnifyResultStatusCodes();
|
||||
|
||||
// app.UseHttpsRedirection(); // 强制https
|
||||
app.UseStaticFiles();
|
||||
|
||||
#region 微信
|
||||
IRegisterService register = RegisterService.Start(senparcSetting.Value).UseSenparcGlobal();//启动 CO2NET 全局注册,必须!
|
||||
register.UseSenparcWeixin(senparcWeixinSetting.Value, senparcSetting.Value);//微信全局注册,必须!
|
||||
#endregion
|
||||
|
||||
app.UseWebSockets();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseCorsAccessor();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseKnife4UI(options =>
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
options.RoutePrefix = "newapi"; // 配置 Knife4UI 路由地址,现在是 /newapi
|
||||
foreach (var groupInfo in SpecificationDocumentBuilder.GetOpenApiGroups())
|
||||
{
|
||||
options.SwaggerEndpoint("/" + groupInfo.RouteTemplate, groupInfo.Title);
|
||||
}
|
||||
});
|
||||
// 注册和配置Mvc和api服务
|
||||
services.ConfigureMvcController();
|
||||
|
||||
app.UseInject(string.Empty);
|
||||
// 注册和配置SqlSugar
|
||||
services.ConfigureSqlSugar();
|
||||
|
||||
//app.MapWebSocketManager("/api/message/websocket", serviceProvider.GetService<IMHandler>());
|
||||
app.MapWebSocketManager("/websocket", serviceProvider.GetRequiredService<IMHandler>());
|
||||
// 注册EventBus服务
|
||||
services.ConfigureEventBus();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
// 注册和配置日志服务
|
||||
services.ConfigureLogging();
|
||||
|
||||
// 注册和配置存储服务
|
||||
services.ConfigureOSSService();
|
||||
|
||||
// 任务调度
|
||||
//services.AddSchedule(options =>
|
||||
//{
|
||||
// options.AddPersistence<DbJobPersistence>();
|
||||
//});
|
||||
|
||||
// 任务调度
|
||||
services.AddTaskScheduler();
|
||||
|
||||
services.AddMemoryCache(); // 使用本地缓存必须添加
|
||||
services.AddConfigurableOptions<CacheOptions>();
|
||||
|
||||
// 微信
|
||||
services.AddSenparcGlobalServices(App.Configuration) // Senparc.CO2NET 全局注册
|
||||
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
||||
|
||||
services.AddOverideVisualDev();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
||||
{
|
||||
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
// 添加状态码拦截中间件
|
||||
app.UseUnifyResultStatusCodes();
|
||||
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
// app.UseHttpsRedirection(); // 强制https
|
||||
app.UseStaticFiles();
|
||||
|
||||
//serviceProvider.GetRequiredService<ITimeTaskService>().StartTimerJob();
|
||||
}
|
||||
#region 微信
|
||||
IRegisterService register = RegisterService.Start(senparcSetting.Value).UseSenparcGlobal();//启动 CO2NET 全局注册,必须!
|
||||
register.UseSenparcWeixin(senparcWeixinSetting.Value, senparcSetting.Value);//微信全局注册,必须!
|
||||
#endregion
|
||||
|
||||
app.UseWebSockets();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseCorsAccessor();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
// 任务调度看板
|
||||
app.UseScheduleUI();
|
||||
|
||||
app.UseKnife4UI(options =>
|
||||
{
|
||||
options.RoutePrefix = "newapi"; // 配置 Knife4UI 路由地址,现在是 /newapi
|
||||
foreach (var groupInfo in SpecificationDocumentBuilder.GetOpenApiGroups())
|
||||
{
|
||||
options.SwaggerEndpoint("/" + groupInfo.RouteTemplate, groupInfo.Title);
|
||||
}
|
||||
});
|
||||
|
||||
app.UseInject(string.Empty);
|
||||
|
||||
//app.MapWebSocketManager("/api/message/websocket", serviceProvider.GetService<IMHandler>());
|
||||
app.MapWebSocketManager("/websocket", serviceProvider.GetRequiredService<IMHandler>());
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
|
||||
//serviceProvider.GetRequiredService<ITimeTaskService>().StartTimerJob();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user