1234567891011121314151617181920212223242526272829303132333435 |
- package services
- import (
- "hongze/hongze_mfyx_gzh/models"
- "hongze/hongze_mfyx_gzh/utils"
- "time"
- )
- func AddCygxUserRecord(wxUserInfo *WxUserInfo) {
- items := new(models.CygxMfyxGzhUserRecord)
- items.OpenId = wxUserInfo.Openid
- items.UnionId = wxUserInfo.Unionid
- items.NickName = wxUserInfo.Nickname
- items.Sex = wxUserInfo.Sex
- items.Province = wxUserInfo.Province
- items.City = wxUserInfo.City
- items.Country = wxUserInfo.Country
- items.Headimgurl = wxUserInfo.Headimgurl
- items.CreateTime = time.Now()
- user, err := models.GetWxUserItemByUserUnionId(wxUserInfo.Unionid)
- if err != nil && err.Error() != utils.ErrNoRow() {
- go utils.SendAlarmMsg("发送邮件:用户关注买方研选时记录相关信息失败,GetWxUserItemByUserUnionId Openid:"+wxUserInfo.Openid+err.Error(), 2)
- return
- }
- if user != nil {
- items.CygxUserId = user.UserId
- items.CygxBindAccount = user.Mobile
- }
- _, err = models.AddMfyxGzhUserRecord(items)
- if err != nil {
- go utils.SendAlarmMsg("发送邮件:用户关注买方研选时记录相关信息失败,Openid:"+wxUserInfo.Openid+err.Error(), 2)
- }
- }
|