report_history_record.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package services
  2. import (
  3. "hongze/hongze_cygx/models"
  4. "hongze/hongze_cygx/utils"
  5. "strconv"
  6. )
  7. // 添加历史信息
  8. func AddCygxReportHistoryRecord(item *models.CygxReportHistoryRecord) (err error) {
  9. //defer func() {
  10. // if err != nil {
  11. // go utils.SendAlarmMsg("产品内测用户浏览信息记录失败"+err.Error(), 2)
  12. // }
  13. //}()
  14. if item.StopTime >= 5 {
  15. _, err = models.AddCygxReportHistoryRecord(item)
  16. if err != nil {
  17. go utils.SendAlarmMsg("报告精选用户浏览信息记录失败"+err.Error()+"报告类型"+item.ReportType+"报告ID:"+strconv.Itoa(item.ArticleId), 2)
  18. }
  19. }
  20. historyRecordLog := new(models.CygxReportHistoryRecordLog)
  21. historyRecordLog.UserId = item.UserId
  22. historyRecordLog.ArticleId = historyRecordLog.ArticleId
  23. historyRecordLog.CreateTime = historyRecordLog.CreateTime
  24. historyRecordLog.Mobile = historyRecordLog.Mobile
  25. historyRecordLog.Email = historyRecordLog.Email
  26. historyRecordLog.CompanyId = historyRecordLog.CompanyId
  27. historyRecordLog.CompanyName = historyRecordLog.CompanyName
  28. historyRecordLog.StopTime = historyRecordLog.StopTime
  29. historyRecordLog.OutType = historyRecordLog.OutType
  30. historyRecordLog.ReportType = historyRecordLog.ReportType
  31. historyRecordLog.RegisterPlatform = historyRecordLog.RegisterPlatform
  32. _, err = models.AddCygxReportHistoryRecordLog(historyRecordLog)
  33. if err != nil {
  34. go utils.SendAlarmMsg("报告精选用户浏览信息日志记录失败"+err.Error()+"报告类型"+item.ReportType+"报告ID:"+strconv.Itoa(item.ArticleId), 2)
  35. }
  36. return
  37. }