| | |
| | | |
| | | } |
| | | |
| | | 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() |
| | | |
| | |
| | | plateNos = append(plateNos, up.PlateNo) |
| | | } |
| | | } |
| | | //客户端cid绑定别名 |
| | | if cid != "" { |
| | | go BindAlias(cid, phoneNum) |
| | | } |
| | | return true, &vo.UserInfo{ |
| | | UserId: u.Id, |
| | | PhoneNum: phoneNum, |
| | |
| | | for _,up := range hikVehicles { |
| | | plateNos = append(plateNos, up.PlateNo) |
| | | } |
| | | } |
| | | //客户端cid绑定别名 |
| | | if cid != "" { |
| | | go BindAlias(cid, phoneNum) |
| | | } |
| | | return true, &vo.UserInfo{ |
| | | UserId: tmpUser.Id, |
| | |
| | | } |
| | | |
| | | 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" |