|
@@ -1,6 +1,7 @@
|
|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
+ "encoding/json"
|
|
|
"eta/eta_report/models"
|
|
|
"eta/eta_report/utils"
|
|
|
"fmt"
|
|
@@ -29,6 +30,7 @@ func (this *SmartReportController) Detail() {
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
reportCode := this.GetString("ReportCode")
|
|
|
+ isReplace, _ := this.GetInt("IsReplace", 0)
|
|
|
if reportCode == "" {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = fmt.Sprintf("参数有误, ReportCode: %s", reportCode)
|
|
@@ -79,6 +81,15 @@ func (this *SmartReportController) Detail() {
|
|
|
br.ErrMsg = "获取免责声明失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
+ // (为了兼容内网客户)需要判断是否替换资源地址
|
|
|
+ var urlReplace models.Report2ImgReplace
|
|
|
+ if isReplace == 1 && conf[models.BusinessConfReport2ImgReplace] != "" {
|
|
|
+ if e := json.Unmarshal([]byte(conf[models.BusinessConfReport2ImgReplace]), &urlReplace); e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("获取报告替换配置失败, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
if conf[models.BusinessConfDisclaimer] != "" {
|
|
|
resp.Disclaimer = conf[models.BusinessConfDisclaimer]
|
|
|
}
|
|
@@ -90,6 +101,21 @@ func (this *SmartReportController) Detail() {
|
|
|
resp.H5ReportShareImg = v
|
|
|
}
|
|
|
|
|
|
+ // 替换地址
|
|
|
+ if urlReplace.IsReplace {
|
|
|
+ if urlReplace.OssUrlOrigin != "" {
|
|
|
+ resp.H5ReportShareImg = strings.ReplaceAll(resp.H5ReportShareImg, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
+ resp.Report.Content = strings.ReplaceAll(resp.Report.Content, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
+ resp.Report.ContentSub = strings.ReplaceAll(resp.Report.ContentSub, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
+ resp.Report.HeadImg = strings.ReplaceAll(resp.Report.HeadImg, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
+ resp.Report.EndImg = strings.ReplaceAll(resp.Report.EndImg, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
+ }
|
|
|
+ if urlReplace.ChartUrlOrigin != "" {
|
|
|
+ resp.Report.Content = strings.ReplaceAll(resp.Report.Content, urlReplace.ChartUrlOrigin, urlReplace.ChartUrlNew)
|
|
|
+ resp.Report.ContentSub = strings.ReplaceAll(resp.Report.ContentSub, urlReplace.ChartUrlOrigin, urlReplace.ChartUrlNew)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 更新pv
|
|
|
if e = models.UpdateSmartReportPv(item.SmartReportId); e != nil {
|
|
|
br.Msg = "获取失败"
|