package services import ( "hongze/hongze_mfyx/models" "hongze/hongze_mfyx/utils" "strconv" "time" ) func AddCygxBannerHistory(user *models.WxUserItem, bannerId int) (err error) { if user.UserId == 0 { return } defer func() { if err != nil { go utils.SendAlarmMsg("banner点击信息记录失败"+err.Error()+"bannerId"+strconv.Itoa(bannerId)+"userId:"+strconv.Itoa(user.UserId), 2) } }() historyRecord := new(models.CygxBannerHistory) historyRecord.UserId = user.UserId historyRecord.BannerId = bannerId historyRecord.CreateTime = time.Now() historyRecord.Mobile = user.Mobile historyRecord.Email = user.Email historyRecord.CompanyId = user.CompanyId historyRecord.CompanyName = user.CompanyName historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2) if err != nil && err.Error() != utils.ErrNoRow() { return } historyRecord.RealName = user.RealName if sellerItem != nil { historyRecord.SellerName = sellerItem.RealName } _, err = models.AddCygxBannerHistory(historyRecord) return }