liuxiaolong
2020-09-07 d36e0b699b56d5b6fb0abf30508b94c98b4b28ca
controllers/car.go
@@ -71,22 +71,22 @@
            if now.Hour() == 22 && now.Minute()>=0 && now.Minute() <=30{
               if now.Minute() == 0 {
                  if nightPushTimes ==0 {
                     go nightPush()
                     go nightPush(nightPushTimes)
                     nightPushTimes++
                  }
               } else if now.Minute() == 10 {
                  if nightPushTimes == 1 {
                     go nightPush()
                     go nightPush(nightPushTimes)
                     nightPushTimes++
                  }
               } else if now.Minute() == 20 {
                  if nightPushTimes == 2{
                     go nightPush()
                     go nightPush(nightPushTimes)
                     nightPushTimes++
                  }
               } else if now.Minute() == 30 {
                  if nightPushTimes == 3{
                     go nightPush()
                     go nightPush(nightPushTimes)
                     nightPushTimes++
                  }
               }
@@ -100,7 +100,7 @@
   }
}
func nightPush(){
func nightPush(curTimes int){
   message := fmt.Sprintf("%s 请尽快驶出停车场", time.Now().Format("2006-01-02 15:04:05"))
   b, e, aliasArr,carOwnNames := service.NightPush("育英中学停车", message)
@@ -119,6 +119,7 @@
   logE.Insert()
   fmt.Println("b:", b,"e:",e, "message:", message)
   if curTimes == 3 { //只给管理员推送一次这个消息
   //将具体的车主信息推送给管理员
   if carOwnNames != nil && len(carOwnNames) >0 {
      //获取车主姓名
@@ -140,6 +141,8 @@
   }
}
}
var cacheSpaceLeft int
var cLock sync.RWMutex
func updateSpaceLeft(num int) {