feat: 添加待确认分类功能,支持获取和确认未分类交易记录;优化相关组件和服务
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 10s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 10s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -102,9 +102,7 @@ public class EmailHandleService(
|
||||
records.Add(record);
|
||||
}
|
||||
|
||||
// var analysisResult = await AnalyzeClassifyAsync(records.ToArray());
|
||||
// TODO 不应该直接保存 应该保存在备用字段上,前端确认后再更新到正式字段
|
||||
|
||||
_ = AutoClassifyAsync(records.ToArray());
|
||||
|
||||
return allSuccess;
|
||||
}
|
||||
@@ -173,11 +171,34 @@ public class EmailHandleService(
|
||||
records.Add(record);
|
||||
}
|
||||
|
||||
_ = await AnalyzeClassifyAsync(records.ToArray());
|
||||
_ = AutoClassifyAsync(records.ToArray());
|
||||
|
||||
return allSuccess;
|
||||
}
|
||||
|
||||
private async Task AutoClassifyAsync(TransactionRecord[] records)
|
||||
{
|
||||
await AnalyzeClassifyAsync(records.ToArray());
|
||||
|
||||
foreach (var record in records)
|
||||
{
|
||||
record.UnconfirmedClassify = record.Classify;
|
||||
record.UnconfirmedType = record.Type;
|
||||
|
||||
record.Classify = ""; // 重置为未分类,等待手动确认
|
||||
}
|
||||
|
||||
await trxRepo.UpdateRangeAsync(records);
|
||||
|
||||
// 消息
|
||||
await messageRecordService.AddAsync(
|
||||
"交易记录待确认分类",
|
||||
$"共有 {records.Length} 条交易记录待确认分类,请点击前往确认。",
|
||||
MessageType.Url,
|
||||
"/unconfirmed-classification"
|
||||
);
|
||||
}
|
||||
|
||||
private string GetEmailByName(string to)
|
||||
{
|
||||
return emailSettings.Value.SmtpList.FirstOrDefault(s => s.Email == to)?.Name ?? to;
|
||||
|
||||
Reference in New Issue
Block a user