修復Line 次數問題

This commit is contained in:
b110212000 2021-09-27 09:18:03 +08:00
parent 082850213d
commit c9f1015060

View File

@ -45,14 +45,14 @@ namespace SolarPower.Quartz.Jobs
{ {
var UserListWithPowerstation = await overviewRepository.GetUserListWithPowerstation(Exception.PowerStationId); var UserListWithPowerstation = await overviewRepository.GetUserListWithPowerstation(Exception.PowerStationId);
foreach (var user in UserListWithPowerstation)
{
var Content = $"電站名稱:{Exception.PowerStationName}" + "<br>" + var Content = $"電站名稱:{Exception.PowerStationName}" + "<br>" +
$"設備編號:{Exception.errDevice}" + "<br>" + $"設備編號:{Exception.errDevice}" + "<br>" +
$"異常ID編號:{Exception.id}" + "<br>" + $"異常ID編號:{Exception.id}" + "<br>" +
$"異常類別:{Exception.alarmClassName}" + "<br>" + $"異常類別:{Exception.alarmClassName}" + "<br>" +
$"設備訊息:{Exception.errMsg}" + "<br>" + $"設備訊息:{Exception.errMsg}" + "<br>" +
$"發生時間:{Exception.dev_time}" ; $"發生時間:{Exception.dev_time}";
foreach (var user in UserListWithPowerstation)
{
NoticeSchedule DaySchedule = new NoticeSchedule() NoticeSchedule DaySchedule = new NoticeSchedule()
{ {
UserId = user.Id, UserId = user.Id,
@ -77,8 +77,11 @@ namespace SolarPower.Quartz.Jobs
}; };
await noticeScheduleRepository.AddOneAsync(DaySchedule, properties); await noticeScheduleRepository.AddOneAsync(DaySchedule, properties);
}
var powerstation = await powerStationRepository.GetOneAsync(Exception.PowerStationId); var powerstation = await powerStationRepository.GetOneAsync(Exception.PowerStationId);
if(powerstation.line_token != null) if (powerstation.line_token != null)
{ {
Content = " %0D%0A " + Content.Replace("<br>", " %0D%0A "); Content = " %0D%0A " + Content.Replace("<br>", " %0D%0A ");
CallLineToken(Content, powerstation.line_token); CallLineToken(Content, powerstation.line_token);
@ -86,7 +89,6 @@ namespace SolarPower.Quartz.Jobs
} }
} }
} }
}
catch (Exception exception) catch (Exception exception)
{ {
logger.LogError("【{0}】{1}", nameof(logger), exception.Message); logger.LogError("【{0}】{1}", nameof(logger), exception.Message);