From ba77b9d036e2e40338316cbcc8b37c9733757671 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 24 十一月 2023 19:10:48 +0800
Subject: [PATCH] fix

---
 service/input_history_search.go |   11 +++--------
 controllers/operation.go        |    2 +-
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/controllers/operation.go b/controllers/operation.go
index a83dd97..4cb2ab8 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -758,7 +758,7 @@
 		return err
 	}
 	for _, history := range histories {
-		service.AddNewHistoryReportRecord(history.Id)
+		service.AddNewHistoryReportRecord(history)
 	}
 	return nil
 }
diff --git a/service/input_history_search.go b/service/input_history_search.go
index c3aca77..12cd9bb 100644
--- a/service/input_history_search.go
+++ b/service/input_history_search.go
@@ -76,19 +76,14 @@
 	return
 }
 
-func AddNewHistoryReportRecord(moveHistoryId int) {
+func AddNewHistoryReportRecord(record *models.MoveHistory) {
 	var report HistoryReport
-	record, err := models.NewMoveHistorySearch().SetID(uint(moveHistoryId)).First()
-	if err != nil {
-		logx.Errorf("AddNewHistoryReportRecord Find err:%v", err)
-		return
-	}
-	err = structx.AssignTo(record, &report)
+	err := structx.AssignTo(record, &report)
 	if err != nil {
 		logx.Errorf("AddNewHistoryReportRecord AssignTo err:%v", err)
 		return
 	}
-	err = blevex.Add(HistoryReportIndexName, strconv.Itoa(moveHistoryId), report)
+	err = blevex.Add(HistoryReportIndexName, strconv.Itoa(record.Id), report)
 	if err != nil {
 		logx.Errorf("AddNewHistoryReportRecord bleve add err:%v", err)
 		return

--
Gitblit v1.8.0