Bladeren bron

no message

xingzai 3 jaren geleden
bovenliggende
commit
8becc3444f
3 gewijzigde bestanden met toevoegingen van 8 en 8 verwijderingen
  1. 5 5
      controllers/article.go
  2. 1 1
      models/article_history_record.go
  3. 2 2
      services/article.go

+ 5 - 5
controllers/article.go

@@ -544,8 +544,8 @@ func (this *ArticleController) AddStopTime() {
 	if stopTime == 0 {
 		stopTime = 1
 	}
-	if outType != 1 {
-		outType = 2
+	if outType != 2 {
+		outType = 1
 	}
 	detail := new(models.ArticleDetail)
 	hasPermission := 0
@@ -627,15 +627,15 @@ func (this *ArticleController) AddStopTime() {
 				record.Email = user.Email
 				record.CompanyId = user.CompanyId
 				record.CompanyName = user.CompanyName
-				record.StopTime = req.StopTime
-				record.OutType = req.OutType
+				record.StopTime = stopTime
+				record.OutType = outType
 				//不统计本公司的阅读记录、正常退出的不做时间差统计
 				if user.CompanyId != 16 {
 					if !utils.Rc.IsExist(key) || req.OutType != 2 {
 						//新增浏览记录
 						go models.AddCygxArticleViewRecordNewpv(record)
 					} else {
-						go models.UpdateCygxArticleViewRecordNewpv(record, req.StopTime)
+						go models.UpdateCygxArticleViewRecordNewpv(record, stopTime)
 					}
 				}
 				utils.Rc.Put(key, 1, 10*time.Minute)

+ 1 - 1
models/article_history_record.go

@@ -107,7 +107,7 @@ func GetNoAddStoptimeArticleCount(uid, articleId int) (count int, err error) {
 //最新标的列表
 func GetArticleHistoryList() (items []*CygxArticleHistoryRecordNewpv, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT *  FROM cygx_article_history_record WHERE stop_time >0 `
+	sql := `SELECT *  FROM cygx_article_history_record WHERE company_id != 16 `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }

+ 2 - 2
services/article.go

@@ -564,12 +564,14 @@ func SynchronizationArtclehistory() {
 	if err != nil {
 		fmt.Println("获取列表失败", err)
 	}
+	fmt.Println(len(list))
 	for _, v := range list {
 		endDate := v.ModifyTime.Add(+time.Minute * 10).Format(utils.FormatDateTime)
 		detail, err := models.GetNewArticleHistoryRecordNewpv(v.UserId, v.ArticleId, endDate)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			fmt.Println("获取信息失败", err)
 		}
+		v.OutType = 1
 		fmt.Println(v.Id)
 		if detail == nil {
 			_, err = models.AddCygxArticleViewRecordNewpv(v)
@@ -582,8 +584,6 @@ func SynchronizationArtclehistory() {
 				fmt.Println("修改失败", err)
 			}
 		}
-
 	}
-	fmt.Println(len(list))
 	fmt.Println("同步结束")
 }