Commit 8a51a500 by ruyun.zhang@suvalue.com

Merge branch 'feature/new_report' into dev

parents fc7f11fb 5dd9c7f5
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
"EmailOptions": { "EmailOptions": {
"SmtpServer": "smtpdm.aliyun.com", "SmtpServer": "smtpdm.aliyun.com",
"Account": "service@email.suvalue.com", "Account": "service@email.suvalue.com",
"Password": "SuValue123456" "Password": "SuValue123456",
"IsEnable": true
}, },
"Application": { "Application": {
//登录过期时间 //登录过期时间
......
...@@ -55,7 +55,7 @@ static void Main(string[] args) ...@@ -55,7 +55,7 @@ static void Main(string[] args)
var option = services.BuildServiceProvider().GetService<IOptions<EmailOptions>>(); var option = services.BuildServiceProvider().GetService<IOptions<EmailOptions>>();
services.AddEmailUtil(config => { config.Account = option.Value.Account; config.Password = option.Value.Password; config.SmtpServer = option.Value.SmtpServer; }); services.AddEmailUtil(config => { config.Account = option.Value.Account; config.Password = option.Value.Password; config.SmtpServer = option.Value.SmtpServer; config.IsEnable = option.Value.IsEnable; });
var emailService = services.BuildServiceProvider().GetService<IEmailService>(); var emailService = services.BuildServiceProvider().GetService<IEmailService>();
var message = new EmailMessage var message = new EmailMessage
{ {
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
"EmailOptions": { "EmailOptions": {
"SmtpServer": "smtpdm.aliyun.com", "SmtpServer": "smtpdm.aliyun.com",
"Account": "service@email.suvalue.com", "Account": "service@email.suvalue.com",
"Password": "SuValue123456" "Password": "SuValue123456",
"IsEnable": true
}, },
"Application": { "Application": {
//登录过期时间 //登录过期时间
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
"EmailOptions": { "EmailOptions": {
"SmtpServer": "smtpdm.aliyun.com", "SmtpServer": "smtpdm.aliyun.com",
"Account": "service@email.suvalue.com", "Account": "service@email.suvalue.com",
"Password": "SuValue123456" "Password": "SuValue123456",
"IsEnable": true
}, },
"Application": { "Application": {
//登录过期时间 //登录过期时间
......
...@@ -25,6 +25,10 @@ public class EmailOptions ...@@ -25,6 +25,10 @@ public class EmailOptions
/// 密码 /// 密码
/// </summary> /// </summary>
public string Password { get; set; } public string Password { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool IsEnable { get; set; }
} }
...@@ -80,6 +84,9 @@ public Task<bool> SendAsync(EmailMessage message) ...@@ -80,6 +84,9 @@ public Task<bool> SendAsync(EmailMessage message)
public bool Send(EmailMessage message) public bool Send(EmailMessage message)
{ {
if (!options.IsEnable)
return true;
MailMessage mail = new MailMessage(); MailMessage mail = new MailMessage();
try try
{ {
......
...@@ -382,7 +382,7 @@ private void SendEmail(per_allot allot, string mail, int type, DateTime time) ...@@ -382,7 +382,7 @@ private void SendEmail(per_allot allot, string mail, int type, DateTime time)
$"您可以登录<a href=\"http://jixiao.suvalue.com\" target=\"_blank\">http://jixiao.suvalue.com</a>查看详细清空。</p>"; $"您可以登录<a href=\"http://jixiao.suvalue.com\" target=\"_blank\">http://jixiao.suvalue.com</a>查看详细清空。</p>";
} }
//emailService.SendAsync(message); emailService.SendAsync(message);
} }
/// <summary> /// <summary>
......
...@@ -1123,7 +1123,7 @@ private void SendEmail(string mail, string path, string subject, string body) ...@@ -1123,7 +1123,7 @@ private void SendEmail(string mail, string path, string subject, string body)
}; };
if (!string.IsNullOrEmpty(path)) if (!string.IsNullOrEmpty(path))
message.Attachments = new List<string> { path }; message.Attachments = new List<string> { path };
//emailService.Send(message); emailService.Send(message);
} }
/// <summary> /// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment