Explorar el Código

中文PPT转英文PPT配图

hsun hace 1 año
padre
commit
7ef67497ac
Se han modificado 2 ficheros con 25 adiciones y 6 borrados
  1. 19 1
      controllers/ppt_v2.go
  2. 6 5
      models/business_conf.go

+ 19 - 1
controllers/ppt_v2.go

@@ -922,6 +922,24 @@ func (this *PptV2Controller) ToEn() {
 		return
 	}
 
+	// 从基础配置中取出第一张封面图, 作为英文PPT的图片, 没有则取原PPT背景图
+	conf, e := models.GetBusinessConf()
+	if e != nil {
+		br.Msg = "获取PPT图配置失败"
+		br.ErrMsg = "获取PPT图配置失败, Err: " + e.Error()
+		return
+	}
+	coverImg := ""
+	if conf[models.BusinessConfEnPptCoverImgs] != "" {
+		imgArr := strings.Split(conf[models.BusinessConfEnPptCoverImgs], ",")
+		if len(imgArr) > 0 {
+			coverImg = imgArr[0]
+		}
+	}
+	if coverImg == "" {
+		coverImg = origin.BackgroundImg
+	}
+
 	_, e = ppt_english.GetPptGroupByGroupIdAdminId(int64(req.GroupId), this.SysUser.AdminId)
 	if e != nil {
 		br.Msg = "目录信息有误"
@@ -939,7 +957,7 @@ func (this *PptV2Controller) ToEn() {
 	var newId int64
 	pptInfo := &ppt_english.PptEnglish{
 		TemplateType:  origin.TemplateType,
-		BackgroundImg: origin.BackgroundImg,
+		BackgroundImg: coverImg,
 		Title:         newTitle,
 		ReportType:    origin.ReportType,
 		PptDate:       origin.PptDate,

+ 6 - 5
models/business_conf.go

@@ -9,11 +9,12 @@ import (
 )
 
 const (
-	BusinessConfUseXf       = "UseXf"
-	BusinessConfXfAppid     = "XfAppid"
-	BusinessConfXfApiKey    = "XfApiKey"
-	BusinessConfXfApiSecret = "XfApiSecret"
-	BusinessConfXfVcn       = "XfVcn"
+	BusinessConfUseXf          = "UseXf"
+	BusinessConfXfAppid        = "XfAppid"
+	BusinessConfXfApiKey       = "XfApiKey"
+	BusinessConfXfApiSecret    = "XfApiSecret"
+	BusinessConfXfVcn          = "XfVcn"
+	BusinessConfEnPptCoverImgs = "EnPptCoverImgs"
 )
 
 // BusinessConf 商户配置表