package services import ( "fmt" "hongze/hongze_cygx/models" "hongze/hongze_cygx/utils" ) func GetArticleHistoryByUser(articleIds []int, user *models.WxUserItem) (mapResp map[int]int) { var err error defer func() { if err != nil { fmt.Println(err) go utils.SendAlarmMsg("获取用户的阅读数据,信息失败,Err:"+err.Error(), 3) } }() lenIds := len(articleIds) if lenIds == 0 { return } var condition string var pars []interface{} condition = ` AND article_id IN (` + utils.GetOrmInReplace(lenIds) + `) AND user_id = ?` pars = append(pars, articleIds, user.UserId) list, err := models.GetCygxArticleHistoryRecordNewpvList(condition, pars) if err != nil { return } mapResp = make(map[int]int, 0) for _, v := range list { mapResp[v.ArticleId]++ } return }