Roc il y a 1 mois
Parent
commit
e53396f9d4
1 fichiers modifiés avec 16 ajouts et 1 suppressions
  1. 16 1
      services/report_v2.go

+ 16 - 1
services/report_v2.go

@@ -1766,6 +1766,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
@@ -1820,7 +1823,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
@@ -1875,6 +1879,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
 			}