|
@@ -36,6 +36,7 @@ func (this *ReportShareController) Detail() {
|
|
|
br.ErrMsg = "参数错误,reportCode 为空"
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
report, err := models.GetReportByCode(reportCode)
|
|
|
if err != nil {
|
|
|
br.Msg = "该报告已删除"
|
|
@@ -153,6 +154,8 @@ func (this *ReportShareController) Detail() {
|
|
|
resp.ReportLogo = strings.ReplaceAll(resp.ReportLogo, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
report.Content = strings.ReplaceAll(report.Content, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
report.ContentSub = strings.ReplaceAll(report.ContentSub, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
+ report.HeadImg = strings.ReplaceAll(report.HeadImg, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
+ report.EndImg = strings.ReplaceAll(report.EndImg, urlReplace.OssUrlOrigin, urlReplace.OssUrlNew)
|
|
|
}
|
|
|
if urlReplace.ChartUrlOrigin != "" {
|
|
|
report.Content = strings.ReplaceAll(report.Content, urlReplace.ChartUrlOrigin, urlReplace.ChartUrlNew)
|
|
@@ -167,16 +170,32 @@ func (this *ReportShareController) Detail() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ var hasAuth bool
|
|
|
+ authToken := this.GetString("AuthToken")
|
|
|
+ if authToken != "" {
|
|
|
+ key := fmt.Sprint(utils.CACHE_REPORT_AUTH, authToken)
|
|
|
+ redisReportId, err := utils.Rc.GetUInt64(key)
|
|
|
+ if err == nil && int(redisReportId) == report.Id {
|
|
|
+ hasAuth = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 报告内图表授权
|
|
|
if v, ok := conf[models.BusinessConfIsOpenChartExpired]; ok {
|
|
|
if v == `true` {
|
|
|
- tokenMap := make(map[string]string)
|
|
|
- report.Content = services.HandleReportContent(report.Content, "add", tokenMap)
|
|
|
- //report.ContentStruct = services.HandleReportContent(report.ContentStruct, "add", tokenMap)
|
|
|
+ resp.IsOpenChartExpired = true
|
|
|
|
|
|
- for _, v := range reportChapters {
|
|
|
- v.Content = services.HandleReportContent(v.Content, "add", tokenMap)
|
|
|
+ // 有权限才会添加token
|
|
|
+ if hasAuth {
|
|
|
+ tokenMap := make(map[string]string)
|
|
|
+ report.Content = services.HandleReportContent(report.Content, "add", tokenMap)
|
|
|
+ //report.ContentStruct = services.HandleReportContent(report.ContentStruct, "add", tokenMap)
|
|
|
+
|
|
|
+ for _, v := range reportChapters {
|
|
|
+ v.Content = services.HandleReportContent(v.Content, "add", tokenMap)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|