report_history_record.go 893 B

123456789101112131415161718192021222324252627282930313233
  1. package services
  2. import (
  3. "hongze/hongze_mfyx/models"
  4. "hongze/hongze_mfyx/utils"
  5. )
  6. // 获取 报告精选,本周研究汇总、上周纪要汇总Pv 阅读数据
  7. func GetCygxReportHistoryRecordListMap(articleIds []int, reportType string) (mapPv map[int]int) {
  8. var err error
  9. defer func() {
  10. if err != nil {
  11. go utils.SendAlarmMsg("获取产品内测的阅读数据,信息失败,Err:"+err.Error(), 3)
  12. }
  13. }()
  14. lenArr := len(articleIds)
  15. if lenArr == 0 {
  16. return
  17. }
  18. var condition string
  19. var pars []interface{}
  20. condition = ` AND article_id IN (` + utils.GetOrmInReplace(lenArr) + `) AND report_type = ?`
  21. pars = append(pars, articleIds, reportType)
  22. list, e := models.GetCygxReportHistoryRecordListPv(condition, pars)
  23. if e != nil && e.Error() != utils.ErrNoRow() {
  24. return
  25. }
  26. mapPv = make(map[int]int, 0)
  27. for _, v := range list {
  28. mapPv[v.ArticleId] = v.Pv
  29. }
  30. return
  31. }