From bae4af47f77a195a12a0437584d667465e826e12 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期一, 17 八月 2020 16:09:28 +0800 Subject: [PATCH] add log --- service/userService.go | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) diff --git a/service/userService.go b/service/userService.go index 8f66c41..a468dca 100644 --- a/service/userService.go +++ b/service/userService.go @@ -37,7 +37,7 @@ } var tmpUser models.User - err := tmpUser.SelectByPhoneNum(phoneNum) + err := tmpUser.SelectById(hikPersonId) fmt.Println("login err:", err) if err != nil { //鐢ㄦ埛涓嶅瓨鍦�,鍒欐柊澧� u := models.User{ @@ -58,6 +58,13 @@ 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(), @@ -66,9 +73,9 @@ 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{ @@ -81,12 +88,11 @@ 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 { @@ -97,6 +103,13 @@ 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(), @@ -105,9 +118,9 @@ 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{ -- Gitblit v1.8.0