| | |
| | | c.ServeJSON() |
| | | } |
| | | |
| | | // @router /testPush [get] |
| | | func (c *CarController) TestPush() { |
| | | left := getSpaceLeft() |
| | | message := fmt.Sprintf("%s 剩余车位:%d个", time.Now().Format("2006-01-02 15:04:05"), left) |
| | | b, e := service.PushByAlias("育英中学停车", message) |
| | | |
| | | fmt.Println("b:", b,"e:",e, "message:", message) |
| | | resp := code.Code{} |
| | | if b { |
| | | resp.Success = true |
| | | resp.Status = http.StatusOK |
| | | resp.Data = "推送成功" |
| | | } else { |
| | | resp.Success = false |
| | | resp.Status = http.StatusInternalServerError |
| | | resp.Data = e.Error() |
| | | } |
| | | c.Data["json"] = resp |
| | | c.ServeJSON() |
| | | } |
| | | |
| | | // @router /crossRecord [get] |
| | | func (c *CarController) CrossRecord() { |
| | | sv := service.NewCarService() |