From 8849dda9c4fd92467e2c05c15ea483abae6af8e5 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期三, 12 八月 2020 11:25:39 +0800 Subject: [PATCH] add testPush --- controllers/car.go | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/controllers/car.go b/controllers/car.go index a22189f..732fcff 100644 --- a/controllers/car.go +++ b/controllers/car.go @@ -160,6 +160,27 @@ 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() -- Gitblit v1.8.0