| | |
| | | "errors" |
| | | "fmt" |
| | | "github.com/aliyun/alibaba-cloud-sdk-go/services/dysmsapi" |
| | | "github.com/astaxie/beego" |
| | | "github.com/satori/go.uuid" |
| | | "strings" |
| | | "sync" |
| | | "time" |
| | | ) |
| | |
| | | UserId: u.Id, |
| | | PhoneNum: phoneNum, |
| | | PlateNos: plateNos, |
| | | IsAdmin: isAdmin(phoneNum), |
| | | }, nil |
| | | } else { |
| | | fmt.Println("u.Insert err:", e) |
| | |
| | | } |
| | | } else { //用户已存在 |
| | | if phoneNum != tmpUser.PhoneNum { |
| | | tmpUser.UpdatePhoneNum(tmpUser.PhoneNum, hikPersonId) |
| | | tmpUser.UpdatePhoneNum(phoneNum, hikPersonId) |
| | | } |
| | | var plateNos = make([]string, 0) |
| | | hikVehicles := carSv.GetVehicleListByPerson(hikPersonId) |
| | |
| | | UserId: tmpUser.Id, |
| | | PhoneNum: phoneNum, |
| | | PlateNos: plateNos, |
| | | IsAdmin: isAdmin(phoneNum), |
| | | }, nil |
| | | } |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | func isAdmin(phoneNum string) bool { |
| | | managers := beego.AppConfig.String("nightManagerPhones") |
| | | arr := strings.Split(managers, ",") |
| | | for _,s := range arr { |
| | | if s == phoneNum { |
| | | return true |
| | | } |
| | | } |
| | | |
| | | return false |
| | | } |
| | | |
| | | func (sv *UserService) AddPlateNo(userId, plateNo string) bool { |
| | | var uc models.UserCar |
| | | if uc.Exist(userId, plateNo) { |