From ac134308edf3767ebd243c006f324051402b00ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Tue, 28 Jun 2022 20:21:51 +0800
Subject: [PATCH 1/4] =?UTF-8?q?fix=EF=BC=9A=E8=87=AA=E5=AE=9A=E4=B9=89?=
=?UTF-8?q?=E5=BC=82=E5=B8=B8=E8=BF=94=E5=9B=9E=E4=B8=AD=E6=96=87=E4=B9=B1?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Middleware/GlobalExceptionMiddleware.cs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs b/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs
index db875f8..cdc619a 100644
--- a/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs
+++ b/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs
@@ -106,16 +106,18 @@ namespace ZR.Admin.WebApi.Middleware
sysOperLog.jsonResult = logAttribute.IsSaveResponseData ? sysOperLog.jsonResult : "";
}
}
- LogEventInfo ei = new(logLevel, "GlobalExceptionMiddleware", error);
-
- ei.Exception = ex;
- ei.Message = error;
+ LogEventInfo ei = new(logLevel, "GlobalExceptionMiddleware", error)
+ {
+ Exception = ex,
+ Message = error
+ };
ei.Properties["status"] = 1;//走正常返回都是通过走GlobalExceptionFilter不通过
ei.Properties["jsonResult"] = responseResult;
ei.Properties["requestParam"] = sysOperLog.operParam;
ei.Properties["user"] = HttpContextExtension.GetName(context);
Logger.Log(ei);
+ context.Response.ContentType = "text/json;charset=utf-8";
await context.Response.WriteAsync(responseResult, System.Text.Encoding.UTF8);
SysOperLogService.InsertOperlog(sysOperLog);
From 32ada25a4a05f6574242e24333196909c0a9c2b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Tue, 28 Jun 2022 21:10:40 +0800
Subject: [PATCH 2/4] =?UTF-8?q?chore=EF=BC=9A=E5=8D=87=E7=BA=A7SQLsugar?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.CodeGenerator/ZR.CodeGenerator.csproj | 2 +-
ZR.Model/ZR.Model.csproj | 2 +-
ZR.Repository/ZR.Repository.csproj | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ZR.CodeGenerator/ZR.CodeGenerator.csproj b/ZR.CodeGenerator/ZR.CodeGenerator.csproj
index 5a66912..953bf96 100644
--- a/ZR.CodeGenerator/ZR.CodeGenerator.csproj
+++ b/ZR.CodeGenerator/ZR.CodeGenerator.csproj
@@ -12,6 +12,6 @@
-
+
diff --git a/ZR.Model/ZR.Model.csproj b/ZR.Model/ZR.Model.csproj
index 2d1ccec..46d4ead 100644
--- a/ZR.Model/ZR.Model.csproj
+++ b/ZR.Model/ZR.Model.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj
index 2cc6684..0cc8a71 100644
--- a/ZR.Repository/ZR.Repository.csproj
+++ b/ZR.Repository/ZR.Repository.csproj
@@ -14,7 +14,7 @@
-
+
From 13f8ec1cecc983e02a64c68d9ef983c60b7a11cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Thu, 30 Jun 2022 18:14:05 +0800
Subject: [PATCH 3/4] =?UTF-8?q?feat=EF=BC=9A=E4=BB=BB=E5=8A=A1=E7=BD=91?=
=?UTF-8?q?=E7=BB=9C=E8=AF=B7=E6=B1=82=E6=89=A7=E8=A1=8C=E5=A4=B1=E8=B4=A5?=
=?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.Tasks/TaskScheduler/Job_HttpRequest.cs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ZR.Tasks/TaskScheduler/Job_HttpRequest.cs b/ZR.Tasks/TaskScheduler/Job_HttpRequest.cs
index 7778ed2..b03c06a 100644
--- a/ZR.Tasks/TaskScheduler/Job_HttpRequest.cs
+++ b/ZR.Tasks/TaskScheduler/Job_HttpRequest.cs
@@ -16,6 +16,7 @@ namespace ZR.Tasks.TaskScheduler
internal class Job_HttpRequest : JobBase, IJob
{
private readonly ISysTasksQzService tasksQzService;
+ private readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public Job_HttpRequest(ISysTasksQzService tasksQzService)
{
@@ -32,7 +33,11 @@ namespace ZR.Tasks.TaskScheduler
if (info != null)
{
var result = await HttpHelper.HttpGetAsync("http://" + info.ApiUrl);
- Console.WriteLine(result);
+ logger.Info($"任务【{info.Name}】网络请求执行结果=" + result);
+ }
+ else
+ {
+ throw new CustomException("任务网络请求执行失败,任务不存在");
}
}
}
From 78aa48a97551dbfcc30dc668c15dc0d3965d5a64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Fri, 1 Jul 2022 20:01:40 +0800
Subject: [PATCH 4/4] =?UTF-8?q?feat=EF=BC=9A=E9=82=AE=E4=BB=B6=E5=8F=91?=
=?UTF-8?q?=E9=80=81=E6=96=B0=E5=A2=9E=E7=AD=BE=E5=90=8D=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Infrastructure/OptionsSetting.cs | 1 +
ZR.Admin.WebApi/appsettings.json | 3 ++-
ZR.Common/MailHelper.cs | 25 ++++++++++++++-----------
ZR.Common/ZR.Common.csproj | 2 +-
4 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/Infrastructure/OptionsSetting.cs b/Infrastructure/OptionsSetting.cs
index afd3dff..c6cf6f0 100644
--- a/Infrastructure/OptionsSetting.cs
+++ b/Infrastructure/OptionsSetting.cs
@@ -24,6 +24,7 @@ namespace Infrastructure
public string Password { get; set; }
public string Smtp { get; set; }
public int Port { get; set; }
+ public string Signature { get; set; }
}
///
/// 上传
diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json
index 3789b8b..33712f7 100644
--- a/ZR.Admin.WebApi/appsettings.json
+++ b/ZR.Admin.WebApi/appsettings.json
@@ -47,7 +47,8 @@
"Password": "123456",
//协议
"Smtp": "smtp.qq.com",
- "Port": 587
+ "Port": 587,
+ "Signature": "系统邮件,请勿回复!"
},
//redis服务配置
"RedisServer": {
diff --git a/ZR.Common/MailHelper.cs b/ZR.Common/MailHelper.cs
index 3f52ce9..f3984be 100644
--- a/ZR.Common/MailHelper.cs
+++ b/ZR.Common/MailHelper.cs
@@ -27,10 +27,13 @@ namespace ZR.Common
///
public int Port { get; set; } = 587;
///
+ /// 邮件签名
+ ///
+ public string Signature { get; set; }
+ ///
/// 是否使用SSL协议
///
public bool UseSsl { get; set; } = false;
- public string mailSign = @"邮件来自C# 程序发送";
private readonly MailOptions mailOptions = new();
public MailHelper()
@@ -56,7 +59,7 @@ namespace ZR.Common
}
///
- /// 发送一个人
+ /// 发送一个
///
///
///
@@ -105,8 +108,8 @@ namespace ZR.Common
//收件人
message.To.AddRange(toAddress);
message.Subject = subject;
- //message.Date = DateTime.Now;
-
+ message.Date = DateTime.Now;
+
//创建附件Multipart
Multipart multipart = new Multipart("mixed");
var alternative = new MultipartAlternative();
@@ -120,14 +123,14 @@ namespace ZR.Common
alternative.Add(Html);
}
//文本内容
- if (!string.IsNullOrEmpty(text))
+ //if (!string.IsNullOrEmpty(text))
+ //{
+ var plain = new TextPart(TextFormat.Plain)
{
- var plain = new TextPart(TextFormat.Plain)
- {
- Text = text + "\r\n\n\n" + mailSign
- };
- alternative.Add(plain);
- }
+ Text = text + "\r\n\n\n" + mailOptions.Signature
+ };
+ alternative.Add(plain);
+ //}
//附件
if (!string.IsNullOrEmpty(path))
diff --git a/ZR.Common/ZR.Common.csproj b/ZR.Common/ZR.Common.csproj
index f3df98d..be78c30 100644
--- a/ZR.Common/ZR.Common.csproj
+++ b/ZR.Common/ZR.Common.csproj
@@ -8,7 +8,7 @@
-
+