feat: 重构消息服务,替换消息记录服务为消息服务,更新相关依赖和逻辑
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 20s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

This commit is contained in:
2026-01-10 17:47:09 +08:00
parent b757f18765
commit 6a9c879dee
4 changed files with 17 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ public class EmailHandleService(
IEmailMessageRepository emailRepo,
ITransactionRecordRepository trxRepo,
IEnumerable<IEmailParseServices> emailParsers,
IMessageRecordService messageRecordService,
IMessageService messageService,
ISmartHandleService smartHandleService
) : IEmailHandleService
{
@@ -62,18 +62,15 @@ public class EmailHandleService(
);
if (parsed == null || parsed.Length == 0)
{
await messageRecordService.AddAsync(
await messageService.AddAsync(
"邮件解析失败",
$"来自 {from} 发送给 {to} 的邮件(主题:{subject})未能成功解析内容,可能格式已变更或不受支持。"
$"来自 {from} 发送给 {to} 的邮件(主题:{subject})未能成功解析内容,可能格式已变更或不受支持。",
url: $"/balance?tab=email"
);
logger.LogWarning("未能成功解析邮件内容,跳过账单处理");
return true;
}
await messageRecordService.AddAsync(
"邮件解析成功",
$"来自 {from} 发送给 {to} 的邮件(主题:{subject})已成功解析出 {parsed.Length} 条交易记录。"
);
logger.LogInformation("成功解析邮件,共 {Count} 条交易记录", parsed.Length);
bool allSuccess = true;
@@ -191,7 +188,7 @@ public class EmailHandleService(
await trxRepo.UpdateRangeAsync(records);
// 消息
await messageRecordService.AddAsync(
await messageService.AddAsync(
"交易记录待确认分类",
$"共有 {records.Length} 条交易记录待确认分类,请点击前往确认。",
MessageType.Url,