|
@@ -135,6 +135,7 @@ func AddReportAndChapter(reportInfo *models.Report, inheritReportId int, grantAd
|
|
|
// @return errMsg string
|
|
|
func EditReport(reportInfo *models.Report, req models.EditReq, sysUser *system.Admin) (err error, errMsg string) {
|
|
|
errMsg = `保存失败`
|
|
|
+ oldIsPublicPublish := reportInfo.IsPublicPublish
|
|
|
//var stage int
|
|
|
//if reportInfo.ClassifyNameFirst != req.ClassifyNameFirst || reportInfo.ClassifyNameSecond != req.ClassifyNameSecond {
|
|
|
// // 报告期数
|
|
@@ -269,6 +270,26 @@ func EditReport(reportInfo *models.Report, req models.EditReq, sysUser *system.A
|
|
|
go handleReportPermission(int64(reportInfo.Id), minClassifyId)
|
|
|
}
|
|
|
|
|
|
+ // 更新es里的章节数据
|
|
|
+ if oldIsPublicPublish != reportInfo.IsPublicPublish {
|
|
|
+ if reportInfo.HasChapter == 1 {
|
|
|
+ // 晨周报
|
|
|
+ chapterList, tmpErr := models.GetPublishedChapterListByReportId(reportInfo.Id)
|
|
|
+ if tmpErr != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(chapterList) > 0 {
|
|
|
+ // 更新章节的es数据
|
|
|
+ for _, chapterInfo := range chapterList {
|
|
|
+ err = updateReportChapterEsByChapter(chapterInfo, reportInfo.IsPublicPublish)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|