【移除】移除历史遗留的多个.net core 2.2,.net5引用的部分已经弃用的组件,解决发布独立版本linux x64或其他模式代码编译报错及支撑问题。

This commit is contained in:
jianweie code
2023-12-18 21:02:10 +08:00
parent 432614ffd0
commit de1b6c8015
101 changed files with 160 additions and 40 deletions

View File

@@ -1555,6 +1555,22 @@
<param name="model"></param>
<returns></returns>
</member>
<member name="M:CoreCms.Net.Web.WebApi.Infrastructure.ApiExplorerIgnores.Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.ActionModel)">
<summary>
自带的Controller与swagger3.0冲突,在此排除扫描
</summary>
<param name="action"></param>
</member>
<member name="T:CoreCms.Net.Web.WebApi.Infrastructure.GlobalExceptionsFilterForClent">
<summary>
接口全局异常错误日志
</summary>
</member>
<member name="T:CoreCms.Net.Web.WebApi.Infrastructure.RequiredErrorForClient">
<summary>
请求验证错误处理
</summary>
</member>
<member name="T:CoreCms.Net.Web.Controllers.WeChat.WeChatOffiaccountNotifyController">
<summary>
微信公众号消息推送对接

View File

@@ -0,0 +1,35 @@
/***********************************************************************
* Project: CoreCms.Net *
* Web: https://CoreCms.Net *
* ProjectName: 核心内容管理系统 *
* Author: 大灰灰 *
* Email: JianWeie@163.com *
* CreateTime: 2020-03-15 20:42:29
* Description: 暂无
***********************************************************************/
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace CoreCms.Net.Web.WebApi.Infrastructure
{
public class ApiExplorerIgnores : IActionModelConvention
{
/// <summary>
/// 自带的Controller与swagger3.0冲突,在此排除扫描
/// </summary>
/// <param name="action"></param>
public void Apply(ActionModel action)
{
//冲突的Ocelot.Raft.RaftController
if (action.Controller.ControllerName == ("WxOfficialOAuth") || action.Controller.ControllerName == ("WxOpenOAuth"))
action.ApiExplorer.IsVisible = false;
//Ocelot.Cache.OutputCacheController
if (action.Controller.ControllerName == ("AliPay"))
action.ApiExplorer.IsVisible = false;
if (action.Controller.ControllerName == ("WeChatPay"))
action.ApiExplorer.IsVisible = false;
}
}
}

View File

@@ -0,0 +1,49 @@
/***********************************************************************
* Project: CoreCms.Net *
* Web: https://CoreCms.Net *
* ProjectName: 核心内容管理系统 *
* Author: 大灰灰 *
* Email: JianWeie@163.com *
* Versions: 1.0 *
* CreateTime: 2020-02-05 19:20:08
* Description:
***********************************************************************/
using System.Net;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace CoreCms.Net.Web.WebApi.Infrastructure
{
/// <summary>
/// 接口全局异常错误日志
/// </summary>
public class GlobalExceptionsFilterForClent : IExceptionFilter
{
public void OnException(ExceptionContext context)
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.Web, "全局异常", context.Exception.Message, context.Exception);
HttpStatusCode status = HttpStatusCode.InternalServerError;
//处理各种异常
var jm = new WebApiCallBack
{
status = false,
code = (int)status,
msg = "系统异常" + context.Exception.Message,
data = context.Exception
};
context.ExceptionHandled = true;
context.Result = new ObjectResult(jm);
}
}
}

View File

@@ -0,0 +1,63 @@
/***********************************************************************
* Project: CoreCms.Net *
* Web: https://CoreCms.Net *
* ProjectName: 核心内容管理系统 *
* Author: 大灰灰 *
* Email: JianWeie@163.com *
* CreateTime: 2020-02-17 1:40:34
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Newtonsoft.Json;
namespace CoreCms.Net.Web.WebApi.Infrastructure
{
/// <summary>
/// 请求验证错误处理
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true)]
public class RequiredErrorForClient : ResultFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext actionContext)
{
//base.OnResultExecuting(actionContext);
var modelState = actionContext.ModelState;
List<ErrorView> errors = new List<ErrorView>();
if (!modelState.IsValid)
{
var baseResult = new WebApiCallBack()
{
status = false,
code = 0,
msg = "请提交必要的参数",
};
foreach (var key in modelState.Keys)
{
var state = modelState[key];
if (state.Errors.Any())
{
ErrorView errorView = new ErrorView();
errorView.ErrorName = key;
errorView.Error = state.Errors.First().ErrorMessage;
errors.Add(errorView);
//baseResult.msg += errorView.ErrorName + "-" + errorView.Error;
}
}
baseResult.data = errors;
actionContext.Result = new ContentResult
{
Content = JsonConvert.SerializeObject(baseResult),
ContentType = "application/json"
};
}
}
}
}

View File

@@ -34,6 +34,7 @@ using Yitter.IdGenerator;
using LogLevel = NLog.LogLevel;
using Microsoft.AspNetCore.RateLimiting;
using CoreCms.Net.Model.ViewModels.Options;
using CoreCms.Net.Web.WebApi.Infrastructure;
using Microsoft.Extensions.Configuration;