Browse Source

纪要库PV去重

xingzai 3 years ago
parent
commit
7cda37603e
1 changed files with 20 additions and 13 deletions
  1. 20 13
      controllers/article.go

+ 20 - 13
controllers/article.go

@@ -131,20 +131,27 @@ func (this *ArticleController) Detail() {
 				articlePermissionPermissionName = detail.CategoryName
 			}
 
-			if strings.Contains(companyPermission, articlePermissionPermissionName) {
-				hasPermission = 1
-				historyRecord := new(models.CygxArticleHistoryRecord)
-				historyRecord.UserId = uid
-				historyRecord.ArticleId = articleId
-				historyRecord.CreateTime = time.Now()
-				historyRecord.Mobile = user.Mobile
-				historyRecord.Email = user.Email
-				historyRecord.CompanyId = user.CompanyId
-				historyRecord.CompanyName = user.CompanyName
-				go models.AddCygxArticleHistoryRecord(historyRecord)
-			} else { //无该行业权限
-				hasPermission = 3
+			var detailNew *models.AddStopTimeNewRep
+			detailNew, _ = models.GetNewArticleHistoryRecord(uid, articleId)
+			if detailNew != nil {
+				if detailNew.StopTime != 0 {
+					if strings.Contains(companyPermission, articlePermissionPermissionName) {
+						hasPermission = 1
+						historyRecord := new(models.CygxArticleHistoryRecord)
+						historyRecord.UserId = uid
+						historyRecord.ArticleId = articleId
+						historyRecord.CreateTime = time.Now()
+						historyRecord.Mobile = user.Mobile
+						historyRecord.Email = user.Email
+						historyRecord.CompanyId = user.CompanyId
+						historyRecord.CompanyName = user.CompanyName
+						go models.AddCygxArticleHistoryRecord(historyRecord)
+					} else { //无该行业权限
+						hasPermission = 3
+					}
+				}
 			}
+
 			if hasPermission == 1 {
 				key := "CYGX_ARTICLE_" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
 				if !utils.Rc.IsExist(key) {