Browse Source

ppt 默认展示封面 背景图 去掉默认封底图

gmy 1 week ago
parent
commit
396515f191
1 changed files with 30 additions and 19 deletions
  1. 30 19
      controllers/ppt_v2.go

+ 30 - 19
controllers/ppt_v2.go

@@ -146,19 +146,24 @@ func (this *PptV2Controller) AddPpt() {
 		//}
 		//}
 		pptInfo := &models.PptV2{
 		pptInfo := &models.PptV2{
 			//PptId:         0,
 			//PptId:         0,
-			TemplateType:  req.FirstPage.TemplateType,
-			BackgroundImg: req.FirstPage.ImgUrl,
-			Title:         req.FirstPage.Title,
-			ReportType:    req.FirstPage.ReportType,
-			PptDate:       req.FirstPage.PptDate,
-			Content:       req.Content,
-			CoverContent:  req.CoverContent,
-			CreateTime:    time.Now(),
-			ModifyTime:    time.Now(),
-			AdminId:       this.SysUser.AdminId,
-			AdminRealName: this.SysUser.RealName,
-			PptVersion:    2,
-			TitleSetting:  req.TitleSetting,
+			TemplateType:           req.FirstPage.TemplateType,
+			BackgroundImg:          req.FirstPage.ImgUrl,
+			BackgroundImgId:        req.FirstPage.BackgroundImgId,
+			BackCoverImg:           req.FirstPage.BackCoverImg,
+			BackCoverImgId:         req.FirstPage.BackCoverImgId,
+			CurrentBackgroundImg:   req.FirstPage.CurrentBackgroundImg,
+			CurrentBackgroundImgId: req.FirstPage.CurrentBackgroundImgId,
+			Title:                  req.FirstPage.Title,
+			ReportType:             req.FirstPage.ReportType,
+			PptDate:                req.FirstPage.PptDate,
+			Content:                req.Content,
+			CoverContent:           req.CoverContent,
+			CreateTime:             time.Now(),
+			ModifyTime:             time.Now(),
+			AdminId:                this.SysUser.AdminId,
+			AdminRealName:          this.SysUser.RealName,
+			PptVersion:             2,
+			TitleSetting:           req.TitleSetting,
 		}
 		}
 		newId, err = models.AddPptV2(pptInfo)
 		newId, err = models.AddPptV2(pptInfo)
 		if err != nil {
 		if err != nil {
@@ -184,6 +189,11 @@ func (this *PptV2Controller) AddPpt() {
 		}
 		}
 		pptInfo.TemplateType = req.FirstPage.TemplateType
 		pptInfo.TemplateType = req.FirstPage.TemplateType
 		pptInfo.BackgroundImg = req.FirstPage.ImgUrl
 		pptInfo.BackgroundImg = req.FirstPage.ImgUrl
+		pptInfo.BackgroundImgId = req.FirstPage.BackgroundImgId
+		pptInfo.BackCoverImg = req.FirstPage.BackCoverImg
+		pptInfo.BackCoverImgId = req.FirstPage.BackCoverImgId
+		pptInfo.CurrentBackgroundImg = req.FirstPage.CurrentBackgroundImg
+		pptInfo.CurrentBackgroundImgId = req.FirstPage.CurrentBackgroundImgId
 		pptInfo.Title = req.FirstPage.Title
 		pptInfo.Title = req.FirstPage.Title
 		pptInfo.ReportType = req.FirstPage.ReportType
 		pptInfo.ReportType = req.FirstPage.ReportType
 		pptInfo.PptDate = req.FirstPage.PptDate
 		pptInfo.PptDate = req.FirstPage.PptDate
@@ -191,7 +201,7 @@ func (this *PptV2Controller) AddPpt() {
 		pptInfo.CoverContent = req.CoverContent
 		pptInfo.CoverContent = req.CoverContent
 		pptInfo.ModifyTime = time.Now()
 		pptInfo.ModifyTime = time.Now()
 		pptInfo.TitleSetting = req.TitleSetting
 		pptInfo.TitleSetting = req.TitleSetting
-		err = pptInfo.Update([]string{"TemplateType", "BackgroundImg", "Title", "ReportType", "PptDate", "Content", "ModifyTime", "CoverContent", "TitleSetting"})
+		err = pptInfo.Update([]string{"TemplateType", "BackgroundImg", "BackgroundImgId", "BackCoverImg", "BackCoverImgId", "CurrentBackgroundImg", "CurrentBackgroundImgId", "Title", "ReportType", "PptDate", "Content", "ModifyTime", "CoverContent", "TitleSetting"})
 
 
 		msg = "保存成功"
 		msg = "保存成功"
 	}
 	}
@@ -458,7 +468,7 @@ func (this *PptV2Controller) DetailPpt() {
 		}
 		}
 	}
 	}
 
 
-	// 维护封底 背景图
+	// 维护背景图
 	if pptInfo.CurrentBackgroundImg == "" {
 	if pptInfo.CurrentBackgroundImg == "" {
 		var condition string
 		var condition string
 		var pars []interface{}
 		var pars []interface{}
@@ -478,7 +488,8 @@ func (this *PptV2Controller) DetailPpt() {
 			pptInfo.CurrentBackgroundImgId = imageConfList[0].ImageConfId
 			pptInfo.CurrentBackgroundImgId = imageConfList[0].ImageConfId
 		}
 		}
 	}
 	}
-	if pptInfo.BackCoverImg == "" {
+	// 维护封面图
+	if pptInfo.BackgroundImg == "" {
 		var condition string
 		var condition string
 		var pars []interface{}
 		var pars []interface{}
 
 
@@ -486,15 +497,15 @@ func (this *PptV2Controller) DetailPpt() {
 		pars = append(pars, 1)
 		pars = append(pars, 1)
 
 
 		condition += ` AND image_type=? `
 		condition += ` AND image_type=? `
-		pars = append(pars, 3)
+		pars = append(pars, 1)
 
 
 		condition += ` ORDER BY create_time asc `
 		condition += ` ORDER BY create_time asc `
 
 
 		imageConfList, err := models.GetImageConfByCondition(condition, pars)
 		imageConfList, err := models.GetImageConfByCondition(condition, pars)
 
 
 		if err == nil && len(imageConfList) > 0 {
 		if err == nil && len(imageConfList) > 0 {
-			pptInfo.BackCoverImg = imageConfList[0].Url
-			pptInfo.BackCoverImgId = imageConfList[0].ImageConfId
+			pptInfo.BackgroundImg = imageConfList[0].Url
+			pptInfo.BackgroundImgId = imageConfList[0].ImageConfId
 		}
 		}
 	}
 	}