Ver Fonte

匹配附件修改

jiaojiao7 há 4 anos atrás
pai
commit
ffe88f4ccd
1 ficheiros alterados com 17 adições e 5 exclusões
  1. 17 5
      src/history/util_history.go

+ 17 - 5
src/history/util_history.go

@@ -696,14 +696,26 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 				attachments := (*projectInfo)["attachments"].(map[string]interface{})
 				for _, v := range attachments {
 					atta := v.(map[string]interface{})
-					fileMap := map[string]interface{}{
-						"filename": atta["filename"],
-						"url":      fileUrl + qu.ObjToString(atta["fid"]),
+					if atta["fid"] != nil {
+						fileMap := map[string]interface{}{
+							"filename": atta["filename"],
+							"url":      fileUrl + qu.ObjToString(atta["fid"]),
+						}
+						filesArr = append(filesArr, fileMap)
+					} else {
+						if atta["org_url"] != nil {
+							fileMap := map[string]interface{}{
+								"filename": atta["filename"],
+								"url":      qu.ObjToString(atta["org_url"]),
+							}
+							filesArr = append(filesArr, fileMap)
+						}
 					}
-					filesArr = append(filesArr, fileMap)
 				}
 				log.Println("查询附件结果:", id, "附件数量:", len(filesArr))
-				tmp["filehref"] = filesArr
+				if len(filesArr) > 0 {
+					tmp["filehref"] = filesArr
+				}
 			}
 		}
 	}