hsun 1 year ago
parent
commit
9adb6e14e7
1 changed files with 3 additions and 1 deletions
  1. 3 1
      models/report.go

+ 3 - 1
models/report.go

@@ -510,9 +510,11 @@ func AddReportAndChapter(reportItem *Report, chapterItemList []*ReportChapter) (
 	if len(chapterItemList) > 0 {
 		for _, chapterItem := range chapterItemList {
 			chapterItem.ReportId = int(reportId)
-			if _, tmpErr := to.Insert(chapterItem); tmpErr != nil {
+			cpId, tmpErr := to.Insert(chapterItem)
+			if tmpErr != nil {
 				return
 			}
+			chapterItem.ReportChapterId = int(cpId)
 		}
 	}