Explorar o código

默认背景、封底图

gmy hai 2 semanas
pai
achega
512759e224
Modificáronse 1 ficheiros con 37 adicións e 0 borrados
  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 {