From f0d461cbef4193823740a2bc7410189a7d2a6c94 Mon Sep 17 00:00:00 2001 From: jagger Date: Tue, 21 May 2024 10:43:31 +0800 Subject: [PATCH 1/2] fix bug Signed-off-by: jagger Former-commit-id: 20538e4d45cbb65ba09b606a1d1805089b9560a9 --- api/internal/logic/core/pagelisttasklogic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/internal/logic/core/pagelisttasklogic.go b/api/internal/logic/core/pagelisttasklogic.go index 20f3d641..edaee318 100644 --- a/api/internal/logic/core/pagelisttasklogic.go +++ b/api/internal/logic/core/pagelisttasklogic.go @@ -86,7 +86,7 @@ func (l *PageListTaskLogic) PageListTask(req *types.PageTaskReq) (resp *types.Pa } func (l *PageListTaskLogic) updateTaskStatus(tasklist []*types.TaskModel, ch chan<- struct{}) { - var list []*types.TaskModel + list := make([]*types.TaskModel, len(tasklist)) copy(list, tasklist) for i := len(list) - 1; i >= 0; i-- { if list[i].AdapterTypeDict != 1 || list[i].Status == constants.Succeeded || list[i].Status == constants.Failed { @@ -209,7 +209,7 @@ func (l *PageListTaskLogic) updateTaskStatus(tasklist []*types.TaskModel, ch cha } func (l *PageListTaskLogic) updateAiTaskStatus(tasklist []*types.TaskModel, ch chan<- struct{}) { - var list []*types.TaskModel + list := make([]*types.TaskModel, len(tasklist)) copy(list, tasklist) for i := len(list) - 1; i >= 0; i-- { if list[i].AdapterTypeDict != 1 || list[i].Status == constants.Succeeded || list[i].Status == constants.Failed { From 01fd992d63358e680127cc7832425ae40257d4b4 Mon Sep 17 00:00:00 2001 From: jagger Date: Tue, 21 May 2024 10:53:51 +0800 Subject: [PATCH 2/2] fix bug Signed-off-by: jagger Former-commit-id: 0fc35eae8d80c1e3813f6e0b48812457d0350c52 --- pkg/utils/timeutils/time.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/utils/timeutils/time.go b/pkg/utils/timeutils/time.go index 567c3093..5e98e3a7 100644 --- a/pkg/utils/timeutils/time.go +++ b/pkg/utils/timeutils/time.go @@ -85,7 +85,7 @@ func MillisecondsToUTCString(milliseconds int64, layout string) string { // 创建time.Time对象 timeObj := time.Unix(timestamp, (milliseconds%1000)*int64(time.Millisecond)) // 使用RFC3339格式返回UTC时间字符串 - return timeObj.UTC().Format(layout) + return timeObj.Local().Format(layout) } // SecondsToUTCString 将秒时间戳转换为UTC时间的字符串表示 @@ -93,7 +93,7 @@ func SecondsToUTCString(seconds int64, layout string) string { // 创建time.Time对象 timeObj := time.Unix(seconds, 0) // 使用RFC3339格式返回UTC时间字符串 - return timeObj.UTC().Format(layout) + return timeObj.Local().Format(layout) } // MillisecondsToAddDurationToUTCString 将毫秒时间戳加上持续时间毫秒后转换为UTC时间的字符串表示 @@ -105,5 +105,5 @@ func MillisecondsToAddDurationToUTCString(milliseconds int64, durationMillisecon // 添加持续时间 duration := time.Duration(durationMilliseconds) * time.Millisecond // 返回加上持续时间后的UTC时间字符串 - return timeObj.Add(duration).UTC().Format(layout) + return timeObj.Add(duration).Local().Format(layout) }