Compare commits

..

2 Commits

Author SHA1 Message Date
lyndonliu b5e608cf94 Merge branch 'dev' of https://gitea.23544.com/marking/Picture.Cut.Service into dev
部署到开发环境 / 编译发布 (push) Successful in 2m56s Details
2024-04-01 17:52:02 +08:00
lyndonliu 0005e17b3b fix: 异常钉钉通知 2024-04-01 17:51:57 +08:00
3 changed files with 26 additions and 0 deletions

View File

@ -445,6 +445,7 @@ public class ExamManager : DomainService, IExamManager
catch (Exception ex)
{
Logger.LogError("{ExamSubjectId} {penSerial} 收集失败! {error}", eto.ExamSubjectId, penSerial, ex);
await NotifyExt.DingTalk($"{eto.ExamSubjectId} {penSerial} 收集失败! 异常:{ex.Message}");
}
finally
{

View File

@ -1,4 +1,5 @@
using Dolphin.ExamPictureCut.Exams;
using Dolphin.ExamPictureCut.Extensions;
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 });
}
public async Task NotifyTest()
{
await NotifyExt.DingTalk($"{530151329325125} {"BP2-3G3-07K-C1"} 收集失败! 异常: {""}");
}
}

View File

@ -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();
}
}