|
@@ -95,24 +95,24 @@ func (this *ArticleController) Detail() {
|
|
}
|
|
}
|
|
if strings.Contains(companyPermission, articlePermission.PermissionName) {
|
|
if strings.Contains(companyPermission, articlePermission.PermissionName) {
|
|
hasPermission = 1
|
|
hasPermission = 1
|
|
- bm, err := cache.NewCache("file", `{"CachePath":"./temp/cache","FileSuffix":".cache","DirectoryLevel":2,"EmbedExpiry":120}`)
|
|
+
|
|
- if err != nil {
|
|
+
|
|
- fmt.Println("false")
|
|
+
|
|
- }
|
|
+
|
|
- key := "ViewRecord:" + strconv.Itoa(uid) + "_" + strconv.Itoa(articleId)
|
|
+
|
|
- if !bm.IsExist(key) {
|
|
+
|
|
-
|
|
+
|
|
- record := new(models.CygxArticleViewRecord)
|
|
+
|
|
- record.UserId = uid
|
|
+
|
|
- record.ArticleId = articleId
|
|
+
|
|
- record.CreateTime = time.Now()
|
|
+
|
|
- record.Mobile = user.Mobile
|
|
+
|
|
- record.Email = user.Email
|
|
+
|
|
- record.CompanyId = user.CompanyId
|
|
+
|
|
- record.CompanyName = user.CompanyName
|
|
+
|
|
- go models.AddCygxArticleViewRecord(record)
|
|
+
|
|
- bm.Put(key, 1, 30*time.Second)
|
|
+
|
|
- }
|
|
+
|
|
historyRecord := new(models.CygxArticleHistoryRecord)
|
|
historyRecord := new(models.CygxArticleHistoryRecord)
|
|
historyRecord.UserId = uid
|
|
historyRecord.UserId = uid
|
|
historyRecord.ArticleId = articleId
|
|
historyRecord.ArticleId = articleId
|