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/Middleware/GlobalExceptionMiddleware.cs b/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs
index bc43fc4..c1b224e 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);
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.CodeGenerator/ZR.CodeGenerator.csproj b/ZR.CodeGenerator/ZR.CodeGenerator.csproj
index bce93a2..4b7e722 100644
--- a/ZR.CodeGenerator/ZR.CodeGenerator.csproj
+++ b/ZR.CodeGenerator/ZR.CodeGenerator.csproj
@@ -1,17 +1,17 @@
-
- net6.0
-
+
+ net6.0
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
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 d376c8c..5028925 100644
--- a/ZR.Common/ZR.Common.csproj
+++ b/ZR.Common/ZR.Common.csproj
@@ -1,18 +1,18 @@
-
- net6.0
-
+
+ net6.0
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
diff --git a/ZR.Model/ZR.Model.csproj b/ZR.Model/ZR.Model.csproj
index 7e96b51..cd3ab6a 100644
--- a/ZR.Model/ZR.Model.csproj
+++ b/ZR.Model/ZR.Model.csproj
@@ -1,20 +1,20 @@
-
- net6.0
-
+
+ net6.0
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj
index d55b378..0a0585b 100644
--- a/ZR.Repository/ZR.Repository.csproj
+++ b/ZR.Repository/ZR.Repository.csproj
@@ -1,23 +1,23 @@
-
- net6.0
-
+
+ net6.0
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj
index 9dca052..eedae5a 100644
--- a/ZR.Service/ZR.Service.csproj
+++ b/ZR.Service/ZR.Service.csproj
@@ -1,17 +1,17 @@
-
- net6.0
-
+
+ net6.0
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
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("任务网络请求执行失败,任务不存在");
}
}
}