Ver Fonte

Merge branch 'fix/smart_report_content' into debug

Roc há 1 mês atrás
pai
commit
0de915aeb1
1 ficheiros alterados com 16 adições e 1 exclusões
  1. 16 1
      services/report_v2.go

+ 16 - 1
services/report_v2.go

@@ -1865,6 +1865,9 @@ func handleTableLinkReportId(link string, reportId, fromScene int) string {
 			utils.FileLog.Info("处理链接失败,ERR:" + err.Error())
 		}
 	}()
+	if link == `` {
+		return
+	}
 	parsedURL, err := url.Parse(link)
 	if err != nil {
 		return link
@@ -1919,7 +1922,8 @@ func HandleReportContentStructTable(reportId int, body string) (newBody string)
 	}
 
 	// 将处理后的数据转换回JSON字符串
-	modifiedJSON, err := json.MarshalIndent(jsonData, "", "  ")
+	//modifiedJSON, err := json.MarshalIndent(jsonData, "", "  ")
+	modifiedJSON, err := json.Marshal(jsonData)
 	if err != nil {
 		fmt.Println("Error marshaling JSON:", err)
 		return
@@ -1974,6 +1978,17 @@ func processMapTable(data map[string]interface{}, reportId, fromScene int) error
 		switch v := value.(type) {
 		case string:
 			if key == "content" {
+				contentSource, ok := data["compType"]
+				if !ok {
+					continue
+				}
+				contentSourceType, ok := contentSource.(string)
+				if !ok {
+					continue
+				}
+				if !utils.InArrayByStr([]string{`sheet`, `chart`}, contentSourceType) {
+					continue
+				}
 				newContent := handleTableLinkReportId(v, reportId, fromScene)
 				data[key] = newContent
 			}