Browse Source

策略报告重新解析

xingzai 3 years ago
parent
commit
1fba2ac7af
1 changed files with 8 additions and 2 deletions
  1. 8 2
      services/tactics.go

+ 8 - 2
services/tactics.go

@@ -692,8 +692,14 @@ func BodyAnalysis2(body string) (expertNumStr, expertContentStr, interviewDateSt
 				numEnd := strings.Index(v, ".pdf")
 				fileLink = v[numStar : numEnd+4]
 			}
-			if strings.Index(v, ".pdf") > 0 {
-				body = strings.Replace(body, v, "", -1)
+			//处理a标签中的PDF
+			numStarAcount := strings.Index(v, "<a")
+			numEndAcount := strings.Index(v, "<img")
+			if numStarAcount < numEndAcount && strings.Index(fileLink, ".pdf") > 0 {
+				Acount := v[numStarAcount:numEndAcount]
+				if Acount != "" {
+					body = strings.Replace(body, Acount, "", -1)
+				}
 			}
 		}
 		if !strings.HasPrefix(fileLink, "https") && len(fileLink) > 0 {