feat: 添加深度复制功能,优化自动分类逻辑;更新周期账单视图以显示下次执行时间
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 43s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 43s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
This commit is contained in:
@@ -3,6 +3,18 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Common;
|
||||
|
||||
public static class TypeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 深度复制对象属性到目标对象
|
||||
/// </summary>
|
||||
public static T? DeepClone<T>(this T source)
|
||||
{
|
||||
var json = System.Text.Json.JsonSerializer.Serialize(source);
|
||||
return System.Text.Json.JsonSerializer.Deserialize<T>(json);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 服务依赖注入扩展
|
||||
/// </summary>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
global using Microsoft.Extensions.Configuration;
|
||||
global using Common;
|
||||
@@ -36,6 +36,7 @@
|
||||
</template>
|
||||
</van-cell>
|
||||
<van-cell title="分类" :value="item.classify || '未分类'" />
|
||||
<van-cell title="下次执行时间" :value="formatDateTime(item.nextExecuteTime) || '未设置'" />
|
||||
<van-cell title="状态">
|
||||
<template #value>
|
||||
<van-switch
|
||||
@@ -246,6 +247,7 @@ import {
|
||||
} from '@/api/transactionPeriodic'
|
||||
import PopupContainer from '@/components/PopupContainer.vue'
|
||||
import ClassifySelector from '@/components/ClassifySelector.vue'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
const router = useRouter()
|
||||
const navTitle = ref('周期账单')
|
||||
@@ -507,6 +509,12 @@ const toggleEnabled = async (id, enabled) => {
|
||||
}
|
||||
}
|
||||
|
||||
const formatDateTime = (date) => {
|
||||
if (!date) return ''
|
||||
|
||||
return dayjs(date).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
|
||||
// 重置表单
|
||||
const resetForm = () => {
|
||||
form.id = null
|
||||
|
||||
Reference in New Issue
Block a user