Browse Source

章节es里的未公开发布字段

xyxie 3 months ago
parent
commit
b4b11840b7
2 changed files with 7 additions and 6 deletions
  1. 2 2
      controllers/report_chapter.go
  2. 5 4
      services/report.go

+ 2 - 2
controllers/report_chapter.go

@@ -1409,7 +1409,7 @@ func (this *ReportController) PublishDayWeekReportChapter() {
 
 	// 更新章节ES
 	{
-		go services.UpdateReportChapterEs(chapterInfo.ReportChapterId)
+		go services.UpdateReportChapterEs(chapterInfo.ReportChapterId, reportInfo.IsPublicPublish)
 	}
 
 	// 同时发布报告
@@ -1719,7 +1719,7 @@ func (this *ReportController) CancelPublishReportChapter() {
 
 	// 更新章节ES
 	{
-		go services.UpdateReportChapterEs(chapterInfo.ReportChapterId)
+		go services.UpdateReportChapterEs(chapterInfo.ReportChapterId, reportInfo.IsPublicPublish)
 	}
 
 	br.Ret = 200

+ 5 - 4
services/report.go

@@ -143,7 +143,7 @@ func UpdateReportEs(reportId int, publishState int) (err error) {
 		if len(chapterList) > 0 {
 			// 更新章节的es数据
 			for _, chapterInfo := range chapterList {
-				err = updateReportChapterEsByChapter(chapterInfo)
+				err = updateReportChapterEsByChapter(chapterInfo, reportInfo.IsPublicPublish)
 				if err != nil {
 					return
 				}
@@ -242,7 +242,7 @@ func addCategoryAliasToArr(categoryArr []string) (aliasArr []string, err error)
 // @datetime 2024-06-20 13:16:22
 // @param reportChapterId int
 // @return err error
-func UpdateReportChapterEs(reportChapterId int) (err error) {
+func UpdateReportChapterEs(reportChapterId int, isPublicPublish int8) (err error) {
 	if reportChapterId <= 0 {
 		return
 	}
@@ -251,7 +251,7 @@ func UpdateReportChapterEs(reportChapterId int) (err error) {
 		return
 	}
 
-	err = updateReportChapterEsByChapter(chapterInfo)
+	err = updateReportChapterEsByChapter(chapterInfo, isPublicPublish)
 	if err != nil {
 		return
 	}
@@ -265,7 +265,7 @@ func UpdateReportChapterEs(reportChapterId int) (err error) {
 // @datetime 2024-06-20 13:16:11
 // @param chapterInfo *models.ReportChapter
 // @return err error
-func updateReportChapterEsByChapter(chapterInfo *models.ReportChapter) (err error) {
+func updateReportChapterEsByChapter(chapterInfo *models.ReportChapter, isPublicPublish int8) (err error) {
 	// 章节对应的品种
 	obj := report.ReportChapterPermissionMapping{}
 	permissionList, tmpErr := obj.GetPermissionItemListById(chapterInfo.ReportChapterId)
@@ -290,6 +290,7 @@ func updateReportChapterEsByChapter(chapterInfo *models.ReportChapter) (err erro
 		BodyContent:        utils.TrimHtml(html.UnescapeString(chapterInfo.Content)),
 		PublishTime:        chapterInfo.PublishTime.Format(utils.FormatDateTime),
 		PublishState:       chapterInfo.PublishState,
+		IsPublicPublish:    isPublicPublish,
 		Author:             chapterInfo.Author,
 		ClassifyIdFirst:    chapterInfo.ClassifyIdFirst,
 		ClassifyNameFirst:  chapterInfo.ClassifyNameFirst,