liuxiaolong
2020-08-06 dbc843d0b37f786fb816131bcc7ebca86dbe72e9
controllers/car.go
@@ -28,12 +28,11 @@
            hikSta, flag := sv.Statistic()
            if flag {
               left := hikSta.Left
               fmt.Println("realTime left:", left)
               if !initCacheM {
                  models.SetSpaceNo(hikSta.TotalPermPlace)
                  initCacheM = true
               }
               if left <=10 && left != prePushLeft {
               if left <=5 && left != prePushLeft {
                  go func() {
                     message := fmt.Sprintf("%s 剩余车位:%d个", time.Now().Format("2006-01-02 15:04:05"), left)
                     b, e := service.Push("育英智慧停车", message)
@@ -102,8 +101,9 @@
// @Failure 403 {string} json ""
// @router /spaceNo [get]
func (c *CarController) SpaceNo() {
   userId := c.GetString("userId")
   sv := service.NewCarService()
   spaceNos := sv.FindSpaceNo()
   spaceNos := sv.FindSpaceNo(userId)
   sort.Sort(spaceNos)
   resp := code.Code{
      Success: true,
@@ -118,4 +118,17 @@
func (c *CarController) BindCarSpace() {
   c.ServeJSON()
}
// @router /crossRecord [get]
func (c *CarController) CrossRecord() {
   sv := service.NewCarService()
   records := sv.CrossRecords()
   resp := code.Code{
      Success: true,
      Status:  http.StatusOK,
      Data:    records,
   }
   c.Data["json"] = resp
   c.ServeJSON()
}