Răsfoiți Sursa

默认背景、封底图

gmy 2 săptămâni în urmă
părinte
comite
512759e224
1 a modificat fișierele cu 37 adăugiri și 0 ștergeri
  1. 37 0
      controllers/ppt_v2.go

+ 37 - 0
controllers/ppt_v2.go

@@ -457,6 +457,43 @@ func (this *PptV2Controller) DetailPpt() {
 			hasAuth = true
 		}
 	}
+
+	var condition string
+	var pars []interface{}
+
+	// 维护封底 背景图
+	if pptInfo.CurrentBackgroundImg != "" {
+		condition += ` conf_type=? `
+		pars = append(pars, 1)
+
+		condition += ` AND image_type=? `
+		pars = append(pars, 2)
+
+		condition += ` ORDER BY create_time asc `
+
+		imageConfList, err := models.GetImageConfByCondition(condition, pars)
+
+		if err == nil && len(imageConfList) > 0 {
+			pptInfo.CurrentBackgroundImg = imageConfList[0].Url
+			pptInfo.CurrentBackgroundImgId = imageConfList[0].ImageConfId
+		}
+	} else if pptInfo.BackCoverImg != "" {
+		condition += ` conf_type=? `
+		pars = append(pars, 1)
+
+		condition += ` AND image_type=? `
+		pars = append(pars, 3)
+
+		condition += ` ORDER BY create_time asc `
+
+		imageConfList, err := models.GetImageConfByCondition(condition, pars)
+
+		if err == nil && len(imageConfList) > 0 {
+			pptInfo.BackCoverImg = imageConfList[0].Url
+			pptInfo.BackCoverImgId = imageConfList[0].ImageConfId
+		}
+	}
+
 	// 编辑中
 	editor, e := services.UpdatePptEditing(pptId, 0, sysUser.AdminId, sysUser.RealName, false)
 	if e != nil {