diff --git a/Common/ServiceExtension.cs b/Common/ServiceExtension.cs index 4e7a410..2169b30 100644 --- a/Common/ServiceExtension.cs +++ b/Common/ServiceExtension.cs @@ -3,6 +3,18 @@ using Microsoft.Extensions.DependencyInjection; namespace Common; +public static class TypeExtensions +{ + /// + /// 深度复制对象属性到目标对象 + /// + public static T? DeepClone(this T source) + { + var json = System.Text.Json.JsonSerializer.Serialize(source); + return System.Text.Json.JsonSerializer.Deserialize(json); + } +} + /// /// 服务依赖注入扩展 /// diff --git a/Service/EmailServices/EmailHandleService.cs b/Service/EmailServices/EmailHandleService.cs index b4e86c9..6fcaf5e 100644 --- a/Service/EmailServices/EmailHandleService.cs +++ b/Service/EmailServices/EmailHandleService.cs @@ -175,7 +175,14 @@ public class EmailHandleService( private async Task AutoClassifyAsync(TransactionRecord[] records) { - await AnalyzeClassifyAsync(records.ToArray()); + var clone = records.ToArray().DeepClone(); + + if(clone?.Any() != true) + { + return; + } + + await AnalyzeClassifyAsync(clone); foreach (var record in records) { diff --git a/Service/GlobalUsings.cs b/Service/GlobalUsings.cs index 05d55e6..2f64bb0 100644 --- a/Service/GlobalUsings.cs +++ b/Service/GlobalUsings.cs @@ -12,4 +12,5 @@ global using System.Linq; global using Service.AppSettingModel; global using System.Text.Json.Serialization; global using System.Text.Json.Nodes; -global using Microsoft.Extensions.Configuration; \ No newline at end of file +global using Microsoft.Extensions.Configuration; +global using Common; \ No newline at end of file diff --git a/Web/src/views/PeriodicRecord.vue b/Web/src/views/PeriodicRecord.vue index 83d6c19..0f45e62 100644 --- a/Web/src/views/PeriodicRecord.vue +++ b/Web/src/views/PeriodicRecord.vue @@ -36,6 +36,7 @@ +