|
@@ -31,6 +31,7 @@ func (this *ReportShareController) Detail() {
|
|
|
|
|
|
reportCode := this.GetString("ReportCode")
|
|
reportCode := this.GetString("ReportCode")
|
|
isReplace, _ := this.GetInt("IsReplace", 0)
|
|
isReplace, _ := this.GetInt("IsReplace", 0)
|
|
|
|
+ IsPdfGenerate, _ := this.GetInt("IsPdfGenerate", 0)
|
|
if reportCode == "" {
|
|
if reportCode == "" {
|
|
br.Msg = "参数错误"
|
|
br.Msg = "参数错误"
|
|
br.ErrMsg = "参数错误,reportCode 为空"
|
|
br.ErrMsg = "参数错误,reportCode 为空"
|
|
@@ -91,6 +92,14 @@ func (this *ReportShareController) Detail() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ var pdfReplace models.Report2ImgReplace
|
|
|
|
+ if IsPdfGenerate == 1 && conf[models.BusinessConfPdfReportUrlReplace] != "" {
|
|
|
|
+ if e := json.Unmarshal([]byte(conf[models.BusinessConfPdfReportUrlReplace]), &pdfReplace); e != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = fmt.Sprintf("获取报告替换配置失败, %v", e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if conf[models.BusinessConfDisclaimer] != "" {
|
|
if conf[models.BusinessConfDisclaimer] != "" {
|
|
resp.Disclaimer = conf[models.BusinessConfDisclaimer]
|
|
resp.Disclaimer = conf[models.BusinessConfDisclaimer]
|
|
}
|
|
}
|
|
@@ -205,6 +214,22 @@ func (this *ReportShareController) Detail() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 替换地址
|
|
|
|
+ if pdfReplace.IsReplace {
|
|
|
|
+ if pdfReplace.OssUrlOrigin != "" && pdfReplace.OssUrlNew != "" {
|
|
|
|
+ resp.H5ReportShareImg = strings.ReplaceAll(resp.H5ReportShareImg, pdfReplace.OssUrlOrigin, pdfReplace.OssUrlNew)
|
|
|
|
+ resp.ReportLogo = strings.ReplaceAll(resp.ReportLogo, pdfReplace.OssUrlOrigin, pdfReplace.OssUrlNew)
|
|
|
|
+ report.Content = strings.ReplaceAll(report.Content, pdfReplace.OssUrlOrigin, pdfReplace.OssUrlNew)
|
|
|
|
+ report.ContentSub = strings.ReplaceAll(report.ContentSub, pdfReplace.OssUrlOrigin, pdfReplace.OssUrlNew)
|
|
|
|
+ report.HeadImg = strings.ReplaceAll(report.HeadImg, pdfReplace.OssUrlOrigin, pdfReplace.OssUrlNew)
|
|
|
|
+ report.EndImg = strings.ReplaceAll(report.EndImg, pdfReplace.OssUrlOrigin, pdfReplace.OssUrlNew)
|
|
|
|
+ }
|
|
|
|
+ if pdfReplace.ChartUrlOrigin != "" && pdfReplace.ChartUrlNew != "" {
|
|
|
|
+ report.Content = strings.ReplaceAll(report.Content, pdfReplace.ChartUrlOrigin, pdfReplace.ChartUrlNew)
|
|
|
|
+ report.ContentSub = strings.ReplaceAll(report.ContentSub, pdfReplace.ChartUrlOrigin, pdfReplace.ChartUrlNew)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// 更新pv
|
|
// 更新pv
|
|
if e = models.UpdateReportPv(report.Id); e != nil {
|
|
if e = models.UpdateReportPv(report.Id); e != nil {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|