From 0fea5ed1db47870bb628c82eaddf89df3413dc2b Mon Sep 17 00:00:00 2001 From: JianWeie Date: Thu, 22 Jul 2021 11:53:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=85=A8=E5=B1=80=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E8=BF=94=E5=9B=9E=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GlobalExceptionsFilterForAdmin.cs | 2 +- .../GlobalExceptionsFilterForClent.cs | 2 +- CoreCms.Net.Loging/NLogUtil.cs | 4 +++- .../Controllers/Com/DemoController.cs | 14 ++++++++------ .../Controllers/PayNotify/WeChatPayController.cs | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CoreCms.Net.Filter/GlobalExceptionsFilterForAdmin.cs b/CoreCms.Net.Filter/GlobalExceptionsFilterForAdmin.cs index 9164340..f992cf5 100644 --- a/CoreCms.Net.Filter/GlobalExceptionsFilterForAdmin.cs +++ b/CoreCms.Net.Filter/GlobalExceptionsFilterForAdmin.cs @@ -43,7 +43,7 @@ namespace CoreCms.Net.Filter //处理各种异常 var jm = new AdminUiCallBack(); jm.code = (int)status; - jm.msg = "发生了全局异常请联系管理员"; + jm.msg = "系统异常,请查看错误描述并进行解决。"; jm.data = context.Exception; context.ExceptionHandled = true; context.Result = new ObjectResult(jm); diff --git a/CoreCms.Net.Filter/GlobalExceptionsFilterForClent.cs b/CoreCms.Net.Filter/GlobalExceptionsFilterForClent.cs index 87b8f9a..0ff643a 100644 --- a/CoreCms.Net.Filter/GlobalExceptionsFilterForClent.cs +++ b/CoreCms.Net.Filter/GlobalExceptionsFilterForClent.cs @@ -46,7 +46,7 @@ namespace CoreCms.Net.Filter { status = false, code = (int)status, - msg = "发生了全局异常,请联系管理员", + msg = "系统返回异常,请联系管理员进行处理!", data = context.Exception }; context.ExceptionHandled = true; diff --git a/CoreCms.Net.Loging/NLogUtil.cs b/CoreCms.Net.Loging/NLogUtil.cs index a31fbee..c46e4b5 100644 --- a/CoreCms.Net.Loging/NLogUtil.cs +++ b/CoreCms.Net.Loging/NLogUtil.cs @@ -65,8 +65,10 @@ namespace CoreCms.Net.Loging /// 异常 public static void WriteAll(LogLevel logLevel, LogType logType, string logTitle, string message, Exception exception = null) { - WriteDbLog(logLevel, logType, logTitle, message, exception); + //先存文件 WriteFileLog(logLevel, logType, logTitle, message, exception); + //后存数据库 + WriteDbLog(logLevel, logType, logTitle, message, exception); } /// diff --git a/CoreCms.Net.Web.Admin/Controllers/Com/DemoController.cs b/CoreCms.Net.Web.Admin/Controllers/Com/DemoController.cs index 3944b8c..bf01218 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Com/DemoController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Com/DemoController.cs @@ -15,9 +15,11 @@ using CoreCms.Net.Caching.AutoMate.RedisCache; using CoreCms.Net.IServices; using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Utility.Helper; +using Essensoft.Paylink.WeChatPay; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.Options; using ToolGood.Words; namespace CoreCms.Net.Web.Admin.Controllers @@ -28,11 +30,11 @@ namespace CoreCms.Net.Web.Admin.Controllers //[DisableCors] public class DemoController : Controller { - private readonly IToolsServices _toolsServices; + private readonly IOptions _optionsAccessor; - public DemoController(IToolsServices toolsServices) + public DemoController(IOptions optionsAccessor) { - _toolsServices = toolsServices; + _optionsAccessor = optionsAccessor; } @@ -40,12 +42,12 @@ namespace CoreCms.Net.Web.Admin.Controllers /// 默认首页 /// /// - public async Task Index() + public IActionResult Index() { - var t = await _toolsServices.IllegalWordsReplace("测试"); + var outData = _optionsAccessor.Value; //return Content(t); - return Content(t.ToString()); + return Json(outData); } } } diff --git a/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs b/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs index bf417a3..7f6ca06 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/PayNotify/WeChatPayController.cs @@ -35,7 +35,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify private readonly ICoreCmsBillRefundServices _billRefundServices; private readonly IWeChatPayNotifyClient _client; private readonly IOptions _optionsAccessor; - private IRedisOperationRepository _redisOperationRepository; + private readonly IRedisOperationRepository _redisOperationRepository; /// /// 构造函数 ///