|
@@ -94,12 +94,13 @@ func ArticleHistoryStopTime(articleId, stopTime, outType int, user *models.WxUse
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// GetArticleHistoryByArticleId 获取文章阅读 pv map
|
|
|
func GetArticleHistoryByArticleId(articleIds []int) (mapResp map[int]int) {
|
|
|
var err error
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
|
- go utils.SendAlarmMsg("获取用户的阅读数据,信息失败,Err:"+err.Error(), 3)
|
|
|
+ go utils.SendAlarmMsg("获取用户的阅读数据,信息失败,GetArticleHistoryByArticleId Err:"+err.Error(), 3)
|
|
|
}
|
|
|
}()
|
|
|
lenIds := len(articleIds)
|
|
@@ -110,13 +111,23 @@ func GetArticleHistoryByArticleId(articleIds []int) (mapResp map[int]int) {
|
|
|
var pars []interface{}
|
|
|
condition = ` AND article_id IN (` + utils.GetOrmInReplace(lenIds) + `) `
|
|
|
pars = append(pars, articleIds)
|
|
|
- list, err := models.GetCygxArticleHistoryRecordNewpvListPv(condition, pars)
|
|
|
- if err != nil {
|
|
|
+ listCy, e := models.GetCygxArticleHistoryRecordNewpvListPvCy(condition, pars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxArticleHistoryRecordNewpvListPvCy, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
mapResp = make(map[int]int, 0)
|
|
|
- for _, v := range list {
|
|
|
+ for _, v := range listCy {
|
|
|
mapResp[v.ArticleId] = v.Pv
|
|
|
}
|
|
|
+
|
|
|
+ listCl, e := models.GetCygxArticleHistoryRecordNewpvListPvCl(condition, pars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxArticleHistoryRecordNewpvListPvCy, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listCl {
|
|
|
+ mapResp[v.ArticleId] += v.Pv
|
|
|
+ }
|
|
|
return
|
|
|
}
|