|
@@ -7,6 +7,7 @@ using HTEXLib;
|
|
|
using HTEXLib.COMM.Helpers;
|
|
|
using HTEXLib.PPTX.Models;
|
|
|
using Microsoft.Azure.Amqp.Framing;
|
|
|
+using Microsoft.Extensions.Configuration;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using NUnit.Framework.Internal.Execution;
|
|
@@ -113,8 +114,21 @@ IES Morning Report:
|
|
|
static string en_groupTitle = "Personal course list change details:";
|
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
- public static async Task<List<CodeValue> > AccumulateDaily(AzureRedisFactory _azureRedis,AzureCosmosFactory _azureCosmos,
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="_azureRedis"></param>
|
|
|
+ /// <param name="_azureCosmos"></param>
|
|
|
+ /// <param name="coreAPIHttpService"></param>
|
|
|
+ /// <param name="dingDing"></param>
|
|
|
+ /// <param name="_httpClient"></param>
|
|
|
+ /// <param name="_snowflakeId"></param>
|
|
|
+ /// <param name="notifyUrl"></param>
|
|
|
+ /// <param name="_mailFactory"></param>
|
|
|
+ /// <param name="am"></param>
|
|
|
+ /// <param name="pm"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static async Task<List<CodeValue> > AccumulateDaily(IConfiguration _configuration,AzureRedisFactory _azureRedis,AzureCosmosFactory _azureCosmos,
|
|
|
CoreAPIHttpService coreAPIHttpService, DingDing dingDing,HttpClient _httpClient, SnowflakeId _snowflakeId,string notifyUrl, MailFactory _mailFactory, int am=0 ,int pm=0)
|
|
|
{
|
|
|
DateTimeOffset now = DateTimeOffset.Now;
|
|
@@ -254,6 +268,10 @@ IES Morning Report:
|
|
|
List<CodeValue> notifys = new List<CodeValue>();
|
|
|
foreach (var teacher in teachers)
|
|
|
{
|
|
|
+ if (!(teacher.id.Equals("1595321354")|| teacher.id.Equals("1535418750") || teacher.id.Equals("1528783259")))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
StringBuilder notify = new StringBuilder();
|
|
|
#if DEBUG
|
|
|
int sendTime_pm = now.Hour;
|
|
@@ -590,8 +608,7 @@ IES Morning Report:
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
-#if DEBUG
|
|
|
+ template= template.Replace("\r\n", "");
|
|
|
string eventId = $"Evening_Report-{_snowflakeId.NextId()}";
|
|
|
NotifyData notifyData = new NotifyData
|
|
|
{
|
|
@@ -609,9 +626,9 @@ IES Morning Report:
|
|
|
var coreUser = coreUsers.Find(x => x.id.Equals(teacher.id) && !string.IsNullOrWhiteSpace(x.mail));
|
|
|
if (coreUser!=null)
|
|
|
{
|
|
|
- var token = _mailFactory.GetSmtpClient().SendEmail(_azureCosmos, dingDing, eventId, title, template, coreUser.mail, teacher.id, teacher.name);
|
|
|
+ var token = _mailFactory.GetSmtpClient().SendEmail(_azureCosmos, dingDing, eventId, title, template, coreUser.mail, teacher.id, teacher.name, sender: "TEAMModel");
|
|
|
+ // await coreAPIHttpService.SendMail(new Dictionary<string, object> { { "to", coreUser.mail },{ "tid","1234" },{ "vars",new { title=title,body=template } } } ,coreAPIHttpService.options.location,_configuration);
|
|
|
}
|
|
|
-#endif
|
|
|
notify.Append(template);
|
|
|
}
|
|
|
if (tzt.Hour==sendTime_am && !string.IsNullOrWhiteSpace(homeworkSB.ToString()))
|
|
@@ -640,7 +657,7 @@ IES Morning Report:
|
|
|
template=template.Replace("{en_homeworkTitle}", en_homeworkTitle);
|
|
|
break;
|
|
|
}
|
|
|
-#if DEBUG
|
|
|
+ template= template.Replace("\r\n", "");
|
|
|
string eventId = $"Morning_Report-{_snowflakeId.NextId()}";
|
|
|
NotifyData notifyData = new NotifyData
|
|
|
{
|
|
@@ -658,9 +675,9 @@ IES Morning Report:
|
|
|
var coreUser = coreUsers.Find(x => x.id.Equals(teacher.id) && !string.IsNullOrWhiteSpace(x.mail));
|
|
|
if (coreUser!=null)
|
|
|
{
|
|
|
- var token = _mailFactory.GetSmtpClient().SendEmail(_azureCosmos, dingDing, eventId, title, template, coreUser.mail, teacher.id, teacher.name);
|
|
|
+ var token = _mailFactory.GetSmtpClient().SendEmail(_azureCosmos, dingDing, eventId, title, template, coreUser.mail, teacher.id, teacher.name,sender:"TEAMModel");
|
|
|
+ //await coreAPIHttpService.SendMail(new Dictionary<string, object> { { "to", coreUser.mail }, { "tid", "1234" }, { "vars", new { title = title, body = template } } }, coreAPIHttpService.options.location, _configuration);
|
|
|
}
|
|
|
-#endif
|
|
|
notify.Append(template);
|
|
|
}
|
|
|
notifys.Add(new CodeValue { code=teacher.id, value= notify.ToString() });
|