|
@@ -97,37 +97,22 @@ func (this *ArticleController) Detail() {
|
|
|
br.ErrMsg = "报告权限不存在,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
|
|
|
return
|
|
|
}
|
|
|
- if strings.Contains(companyPermission, articlePermission.PermissionName) {
|
|
|
- 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.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
|
|
|
+ for _, p := range articlePermission {
|
|
|
+ if strings.Contains(companyPermission, p.PermissionName) {
|
|
|
+ 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)
|
|
|
+ break
|
|
|
+ } else { //无该行业权限
|
|
|
+ hasPermission = 3
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
collectCount, err := models.GetArticleCollectCount(uid, articleId)
|