From f3a09ce0a6411d49303122d1d123863363e04acf Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 17 十月 2023 22:20:47 +0800
Subject: [PATCH] 删除同步完的记录

---
 crontask/cron_task.go |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/crontask/cron_task.go b/crontask/cron_task.go
index 3ff0d59..cd4e9e6 100644
--- a/crontask/cron_task.go
+++ b/crontask/cron_task.go
@@ -103,6 +103,7 @@
 	if err != nil {
 		logx.Errorf("SyncTaskStatus get records err:%v", err)
 	}
+	syncOkIds := make([]uint, 0, len(records))
 	for _, record := range records {
 		msg := &common.MsgTaskStatusUpdate{
 			WorkOrderId:  record.WorkOrderId,
@@ -116,6 +117,13 @@
 		if err != nil {
 			logx.Errorf("sync task status send msg error:%v", err.Error())
 		}
+		syncOkIds = append(syncOkIds, record.ID)
+	}
+	if len(syncOkIds) > 0 {
+		err = service.NewTaskService().RemoveTaskStatusSync(syncOkIds)
+		if err != nil {
+			logx.Errorf("sync task status delete sync ok records error:%v", err)
+		}
 	}
 }
 

--
Gitblit v1.8.0