1234567891011121314151617181920212223242526272829303132333435363738 |
- package services
- import (
- "errors"
- "hongze/hongze_clpt/models"
- "hongze/hongze_clpt/utils"
- "strconv"
- "time"
- )
- // 记录通过三方合作机构过来的公司
- func AddInviteCompany(user *models.WxUserItem) (err error) {
- defer func() {
- if err != nil && err.Error() != utils.ErrNoRow() {
- go utils.SendAlarmMsg("记录通过三方合作机构过来的公司失败"+err.Error()+"uid:"+strconv.Itoa(user.UserId), 2)
- }
- }()
- item := new(models.CygxInviteCompany)
- if user.InviteCompany != utils.LUODING_CODE {
- return
- } else {
- item.Source = 2
- }
- // 非潜在客户不记录
- if user.CompanyId != 1 {
- return
- }
- item.UserId = user.UserId
- item.Mobile = user.Mobile
- item.Email = user.Email
- item.SourceCode = user.InviteCompany
- item.CreateTime = time.Now()
- e := models.AddCygxInviteCompany(item)
- if e != nil {
- err = errors.New("AddCygxInviteCompany, Err: " + e.Error())
- }
- return
- }
|