From 9358e5ec2d2b65fec4ef9a1be7d1a1e1e2cf9d2d Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期一, 10 八月 2020 16:31:34 +0800 Subject: [PATCH] new push schedule --- service/userService.go | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/service/userService.go b/service/userService.go index 9ca0963..2caaeaf 100644 --- a/service/userService.go +++ b/service/userService.go @@ -16,7 +16,7 @@ } -func (sv *UserService) Login(phoneNum, code string) (bool,*vo.UserInfo,error) { +func (sv *UserService) Login(phoneNum, code, cid string) (bool,*vo.UserInfo,error) { if verifyCode(phoneNum, code) { carSv := NewCarService() @@ -54,6 +54,10 @@ plateNos = append(plateNos, up.PlateNo) } } + //瀹㈡埛绔痗id缁戝畾鍒悕 + if cid != "" { + go BindAlias(cid, phoneNum) + } return true, &vo.UserInfo{ UserId: u.Id, PhoneNum: phoneNum, @@ -71,6 +75,10 @@ for _,up := range hikVehicles { plateNos = append(plateNos, up.PlateNo) } + } + //瀹㈡埛绔痗id缁戝畾鍒悕 + if cid != "" { + go BindAlias(cid, phoneNum) } return true, &vo.UserInfo{ UserId: tmpUser.Id, @@ -101,6 +109,26 @@ } func NewVerifyCode(phoneNum string) error { + var tmpUser models.User + err := tmpUser.SelectByPhoneNum(phoneNum) + if err != nil { //鐢ㄦ埛涓嶅瓨鍦�,娉ㄥ唽鑾峰彇楠岃瘉鐮侊紝姝ゆ墜鏈哄彿蹇呴』鍦ㄨ偛鑻辨捣搴峰钩鍙颁腑 + carSv := NewCarService() + personList := carSv.GetHikPersonList() + found := false + if personList ==nil { + return errors.New("鎵嬫満鍙蜂笉瀛樺湪锛岃鑱旂郴鍋滆溅鍦虹鐞嗗憳") + } else { + for _,p := range personList { + if p.PhoneNo == phoneNum { + found = true + } + } + } + if !found { + return errors.New("鎵嬫満鍙蜂笉瀛樺湪锛岃鑱旂郴鍋滆溅鍦虹鐞嗗憳") + } + } + regionId := "cn-hangzhou" accessKeyId := "LTAIkHFaStA1JKk5" AccessSecret := "oE7LhSqBWWUBzV0B7l1G9aVmgHPddM" -- Gitblit v1.8.0