user_record.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package services
  2. import (
  3. "hongze/hongze_mfyx_gzh/models"
  4. "hongze/hongze_mfyx_gzh/utils"
  5. "time"
  6. )
  7. func AddCygxUserRecord(wxUserInfo *WxUserInfo) {
  8. items := new(models.CygxMfyxGzhUserRecord)
  9. items.OpenId = wxUserInfo.Openid
  10. items.UnionId = wxUserInfo.Unionid
  11. items.NickName = wxUserInfo.Nickname
  12. items.Sex = wxUserInfo.Sex
  13. items.Province = wxUserInfo.Province
  14. items.City = wxUserInfo.City
  15. items.Country = wxUserInfo.Country
  16. items.Headimgurl = wxUserInfo.Headimgurl
  17. items.CreateTime = time.Now()
  18. user, err := models.GetWxUserItemByUserUnionId(wxUserInfo.Unionid)
  19. if err != nil && err.Error() != utils.ErrNoRow() {
  20. go utils.SendAlarmMsg("发送邮件:用户关注买方研选时记录相关信息失败,GetWxUserItemByUserUnionId Openid:"+wxUserInfo.Openid+err.Error(), 2)
  21. return
  22. }
  23. if user != nil {
  24. items.CygxUserId = user.UserId
  25. items.CygxBindAccount = user.Mobile
  26. }
  27. _, err = models.AddMfyxGzhUserRecord(items)
  28. if err != nil {
  29. go utils.SendAlarmMsg("发送邮件:用户关注买方研选时记录相关信息失败,Openid:"+wxUserInfo.Openid+err.Error(), 2)
  30. }
  31. }