fix night push time,and msg title
| | |
| | | if left <=lowerLimit && left != prePushLeft { |
| | | go func() { |
| | | message := fmt.Sprintf("%s 剩余车位:%d个", time.Now().Format("2006-01-02 15:04:05"), left) |
| | | b, e := service.PushByAlias("育英智慧停车", message) |
| | | b, e := service.PushByAlias("育英中学停车", message) |
| | | |
| | | prePushLeft = left |
| | | |
| | |
| | | } |
| | | //判断当前是否在22:00-22:30之间 |
| | | now := time.Now() |
| | | if now.Hour() == 21 && now.Minute()>=0 && now.Minute() <=29{ |
| | | if now.Hour() == 22 && now.Minute()>=0 && now.Minute() <=30{ |
| | | if now.Minute() == 0 { |
| | | if nightPushTimes ==0 { |
| | | go nightPush() |
| | |
| | | go nightPush() |
| | | nightPushTimes++ |
| | | } |
| | | } else if now.Minute() == 29 { |
| | | } else if now.Minute() == 30 { |
| | | if nightPushTimes == 3{ |
| | | go nightPush() |
| | | nightPushTimes++ |
| | |
| | | func nightPush(){ |
| | | |
| | | message := fmt.Sprintf("%s 请尽快驶出停车场", time.Now().Format("2006-01-02 15:04:05")) |
| | | b, e := service.NightPush("育英智慧停车", message) |
| | | b, e := service.NightPush("育英中学停车", message) |
| | | |
| | | fmt.Println("b:", b,"e:",e, "message:", message) |
| | | |
| | |
| | | } |
| | | |
| | | 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 |
| | | } |
| | | 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("手机号不存在,请联系停车场管理员") |
| | | } |
| | | } |
| | | if !found { |
| | | return errors.New("手机号不存在,请联系停车场管理员") |
| | | } |
| | | //var tmpUser models.User |
| | | //err := tmpUser.SelectByPhoneNum(phoneNum) |
| | | //if err != nil { //用户不存在,注册获取验证码,此手机号必须在育英海康平台中 |
| | | // |
| | | //} |
| | | |
| | | regionId := "cn-hangzhou" |
| | | accessKeyId := "LTAIkHFaStA1JKk5" |