fix: 异常钉钉通知
This commit is contained in:
parent
c67424492a
commit
0005e17b3b
|
|
@ -445,6 +445,7 @@ public class ExamManager : DomainService, IExamManager
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.LogError("{ExamSubjectId} {penSerial} 收集失败! {error}", eto.ExamSubjectId, penSerial, ex);
|
Logger.LogError("{ExamSubjectId} {penSerial} 收集失败! {error}", eto.ExamSubjectId, penSerial, ex);
|
||||||
|
await NotifyExt.DingTalk($"{eto.ExamSubjectId} {penSerial} 收集失败! 异常:{ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Dolphin.ExamPictureCut.Exams;
|
using Dolphin.ExamPictureCut.Exams;
|
||||||
|
using Dolphin.ExamPictureCut.Extensions;
|
||||||
|
|
||||||
namespace Dolphin.ExamPictureCut.Services;
|
namespace Dolphin.ExamPictureCut.Services;
|
||||||
|
|
||||||
|
|
@ -14,4 +15,9 @@ public class ExamAppService : DolphinAppService
|
||||||
{
|
{
|
||||||
await _examManager.ExamStudentGather(new() { SchoolId = 3, StudentExamNum = "BP2-3G3-07K-C1", BookId = 529493484986437, ExamSubjectSchoolId = 530151338438726, ExamSubjectId = 530151329325125, LastCollectTime = DateTime.Now });
|
await _examManager.ExamStudentGather(new() { SchoolId = 3, StudentExamNum = "BP2-3G3-07K-C1", BookId = 529493484986437, ExamSubjectSchoolId = 530151338438726, ExamSubjectId = 530151329325125, LastCollectTime = DateTime.Now });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task NotifyTest()
|
||||||
|
{
|
||||||
|
await NotifyExt.DingTalk($"{530151329325125} {"BP2-3G3-07K-C1"} 收集失败! 异常: {"通知测试"}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
using Flurl.Http;
|
||||||
|
|
||||||
|
namespace Dolphin.ExamPictureCut.Extensions;
|
||||||
|
|
||||||
|
public class NotifyExt
|
||||||
|
{
|
||||||
|
public static async Task DingTalk(string text)
|
||||||
|
{
|
||||||
|
await "https://oapi.dingtalk.com/robot/send?access_token=6ddafcada8f44f4bad4a7314c4d9bd19a895ded0a1ba1afdaff5dd01a5af6781".PostJsonAsync(new
|
||||||
|
{
|
||||||
|
msgtype = "markdown",
|
||||||
|
markdown = new
|
||||||
|
{
|
||||||
|
title = "异常通知",
|
||||||
|
text = $"dotpan,{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}异常\n > 来源:Dplphin.ExamPictureCut\n > 详情:" + text,
|
||||||
|
}
|
||||||
|
}).ReceiveString();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue