report_history_record.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package services
  2. import (
  3. "hongze/hongze_clpt/models"
  4. "hongze/hongze_clpt/utils"
  5. "time"
  6. )
  7. func AddCygxReportHistoryRecord(user *models.WxUserItem, articleId int, reportType string) (err error) {
  8. defer func() {
  9. if err != nil {
  10. go utils.SendAlarmMsg("研究汇总用户浏览信息记录失败"+err.Error(), 2)
  11. }
  12. }()
  13. historyRecord := new(models.CygxReportHistoryRecord)
  14. historyRecord.UserId = user.UserId
  15. historyRecord.ArticleId = articleId
  16. historyRecord.CreateTime = time.Now()
  17. historyRecord.Mobile = user.Mobile
  18. historyRecord.Email = user.Email
  19. historyRecord.CompanyId = user.CompanyId
  20. historyRecord.CompanyName = user.CompanyName
  21. historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
  22. historyRecord.ReportType = reportType
  23. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  24. if err != nil && err.Error() != utils.ErrNoRow() {
  25. return
  26. }
  27. historyRecord.RealName = user.RealName
  28. if sellerItem != nil {
  29. historyRecord.SellerName = sellerItem.RealName
  30. }
  31. _, err = models.AddCygxReportHistoryRecord(historyRecord)
  32. return
  33. }