| | |
| | | } |
| | | |
| | | var tmpUser models.User |
| | | err := tmpUser.SelectByPhoneNum(phoneNum) |
| | | err := tmpUser.SelectById(hikPersonId) |
| | | fmt.Println("login err:", err) |
| | | if err != nil { //用户不存在,则新增 |
| | | u := models.User{ |
| | |
| | | if cid != "" { |
| | | go func() { |
| | | var uc models.UserClient |
| | | ucList := uc.GetByCid(cid) |
| | | if ucList != nil && len(ucList) >0 { |
| | | if len(ucList) >1 || ucList[0].PhoneNum != phoneNum { |
| | | unbindB, unE := UnbindAlias(cid) |
| | | fmt.Println("unbindB:", unbindB, "err:", unE) |
| | | } |
| | | } |
| | | if !uc.ExistByCid(phoneNum, cid) { |
| | | new := models.UserClient{ |
| | | Id:uuid.NewV4().String(), |
| | |
| | | BindTime: time.Now().Format("2006-01-02 15:04:05"), |
| | | } |
| | | new.Insert() |
| | | bindR, bindE := BindAlias(cid, phoneNum) |
| | | fmt.Println("bind cid:",cid, "phoneNum:",phoneNum,"result:", bindR, "err:", bindE) |
| | | } |
| | | bindR, bindE := BindAlias(cid, phoneNum) |
| | | fmt.Println("bind cid:",cid, "phoneNum:",phoneNum,"result:", bindR, "err:", bindE) |
| | | }() |
| | | } |
| | | return true, &vo.UserInfo{ |
| | |
| | | return false, nil, errors.New("注册失败") |
| | | } |
| | | } else { //用户已存在 |
| | | if hikPersonId != tmpUser.Id { |
| | | tmpUser.Id = hikPersonId |
| | | tmpUser.SyncHikPersonId(tmpUser.PhoneNum, hikPersonId) |
| | | if phoneNum != tmpUser.PhoneNum { |
| | | tmpUser.UpdatePhoneNum(phoneNum, hikPersonId) |
| | | } |
| | | var plateNos = make([]string, 0) |
| | | hikVehicles := carSv.GetVehicleListByPerson(tmpUser.Id) |
| | | hikVehicles := carSv.GetVehicleListByPerson(hikPersonId) |
| | | |
| | | if hikVehicles != nil { |
| | | for _,up := range hikVehicles { |
| | |
| | | if cid != "" { |
| | | go func() { |
| | | var uc models.UserClient |
| | | ucList := uc.GetByCid(cid) |
| | | if ucList != nil && len(ucList) >0 { |
| | | if len(ucList) >1 || ucList[0].PhoneNum != phoneNum { |
| | | unbindB, unE := UnbindAlias(cid) |
| | | fmt.Println("unbindB:", unbindB, "err:", unE) |
| | | } |
| | | } |
| | | if !uc.ExistByCid(phoneNum, cid) { |
| | | new := models.UserClient{ |
| | | Id:uuid.NewV4().String(), |
| | |
| | | BindTime: time.Now().Format("2006-01-02 15:04:05"), |
| | | } |
| | | new.Insert() |
| | | bindR, bindE := BindAlias(cid, phoneNum) |
| | | fmt.Println("bind cid:",cid, "phoneNum:",phoneNum,"result:", bindR, "err:", bindE) |
| | | } |
| | | bindR, bindE := BindAlias(cid, phoneNum) |
| | | fmt.Println("bind cid:",cid, "phoneNum:",phoneNum,"result:", bindR, "err:", bindE) |
| | | }() |
| | | } |
| | | return true, &vo.UserInfo{ |