Browse Source

报告解析方式的添加

xingzai 2 years ago
parent
commit
cc9cceeb8a
1 changed files with 17 additions and 1 deletions
  1. 17 1
      services/article.go

+ 17 - 1
services/article.go

@@ -1941,7 +1941,7 @@ func GetReportLinkToArticleid(reportLink string) (articleId int, err error) {
 		}
 	}()
 	var artMd5 string
-	//处理报告
+	//处理Md5
 	strnum1 := strings.Index(reportLink, "id=")
 	if strnum1 > 0 {
 		sliceId := strings.Split(reportLink, "id=")
@@ -1960,6 +1960,22 @@ func GetReportLinkToArticleid(reportLink string) (articleId int, err error) {
 				articleId = detail.ArticleId
 			}
 		}
+	} else {
+		//处理活动的
+		linkList := strings.Split(reportLink, "/")
+		if linkList[len(linkList)-1] != "" {
+			linkArticleId, _ := strconv.Atoi(linkList[len(linkList)-1])
+			if linkArticleId > 0 {
+				articleInfo, errArt := models.GetArticleDetailById(linkArticleId)
+				if errArt != nil && errArt.Error() != utils.ErrNoRow() {
+					err = errArt
+					return
+				}
+				if articleInfo != nil {
+					articleId = articleInfo.ArticleId
+				}
+			}
+		}
 	}
 	return
 }