From bf4ca3fdb8c0f0c1f99a4a871ad39436cefc6ab6 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期六, 10 十月 2020 19:37:05 +0800
Subject: [PATCH] 在地图上不显示vip车辆

---
 controllers/car.go |   93 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 84 insertions(+), 9 deletions(-)

diff --git a/controllers/car.go b/controllers/car.go
index f867877..9cccaff 100644
--- a/controllers/car.go
+++ b/controllers/car.go
@@ -45,7 +45,7 @@
 						go func() {
 							t := time.Now().Format("2006-01-02 15:04:05")
 							message := fmt.Sprintf("%s 鍓╀綑杞︿綅锛�%d涓�", t, left)
-							b, e, aliasArr := service.PushByAlias("鑲茶嫳涓鍋滆溅", message, false)
+							b, e, aliasArr := service.PushByAlias("鍓╀綑杞︿綅鎻愰啋", message, false)
 							//璁板綍鎺ㄩ�佹棩蹇�
 							logE := models.Log{
 								Id: uuid.NewV4().String(),
@@ -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,10 +100,10 @@
 	}
 }
 
-func nightPush(){
+func nightPush(curTimes int){
 
 	message := fmt.Sprintf("%s 璇峰敖蹇┒鍑哄仠杞﹀満", time.Now().Format("2006-01-02 15:04:05"))
-	b, e, aliasArr := service.NightPush("鑲茶嫳涓鍋滆溅", message)
+	b, e, aliasArr,carOwnNames := service.NightPush("娓╅Θ鎻愮ず", message)
 	//璁板綍鎺ㄩ�佹棩蹇�
 	logE := models.Log{
 		Id: uuid.NewV4().String(),
@@ -118,6 +118,28 @@
 	}
 	logE.Insert()
 	fmt.Println("b:", b,"e:",e, "message:", message)
+
+	if curTimes == 3 { //鍙粰绠$悊鍛樻帹閫佷竴娆¤繖涓秷鎭�
+		//灏嗗叿浣撶殑杞︿富淇℃伅鎺ㄩ�佺粰绠$悊鍛�
+		if carOwnNames != nil && len(carOwnNames) >0 {
+			//鑾峰彇杞︿富濮撳悕
+			managerMsg := strings.Join(carOwnNames, ",")
+			mb,me, managerArr := service.Push2Manager(fmt.Sprintf("%s 鏈┒绂昏溅杈�", time.Now().Format("2006-01-02 15:04:05")), managerMsg, false)
+			mLogE := models.Log{
+				Id: uuid.NewV4().String(),
+				CreateTime: time.Now().Format("2006-01-02 15:04:05"),
+				Result: mb,
+				Phones: strings.Join(managerArr, ","),
+			}
+			if me != nil {
+				mLogE.Content = me.Error()
+			} else {
+				mLogE.Content = managerMsg
+			}
+			mLogE.Insert()
+			fmt.Println("mb:", mb, "me:", me, "message:", managerMsg)
+		}
+	}
 
 }
 
@@ -191,7 +213,7 @@
 func (c *CarController) TestPush() {
 	left := getSpaceLeft()
 	message := fmt.Sprintf("%s 鍓╀綑杞︿綅锛�%d涓�", time.Now().Format("2006-01-02 15:04:05"), left)
-	b, e, aliasArr := service.PushByAlias("鑲茶嫳涓鍋滆溅", message, true)
+	b, e, aliasArr := service.PushByAlias("鍓╀綑杞︿綅鎻愰啋", message, true)
 	//璁板綍鎺ㄩ�佹棩蹇�
 	logE := models.Log{
 		Id: uuid.NewV4().String(),
@@ -221,10 +243,50 @@
 	c.ServeJSON()
 }
 
+// @router /testNightPush [get]
+func (c *CarController) TestNightPush() {
+	carOwnNames := service.GetLeftCarOwners()
+
+	//灏嗗叿浣撶殑杞︿富淇℃伅鎺ㄩ�佺粰绠$悊鍛�
+	if carOwnNames != nil && len(carOwnNames) >0 {
+		//鑾峰彇杞︿富濮撳悕
+		managerMsg := strings.Join(carOwnNames, ",")
+		mb,me, managerArr := service.Push2Manager(fmt.Sprintf("%s 鏈┒绂昏溅杈�", time.Now().Format("2006-01-02 15:04:05")), managerMsg, true)
+		mLogE := models.Log{
+			Id: uuid.NewV4().String(),
+			CreateTime: time.Now().Format("2006-01-02 15:04:05"),
+			Result: mb,
+			Phones: strings.Join(managerArr, ","),
+		}
+		if me != nil {
+			mLogE.Content = me.Error()
+		} else {
+			mLogE.Content = managerMsg
+		}
+		mLogE.Insert()
+		fmt.Println("mb:", mb, "me:", me, "message:", managerMsg)
+
+		c.Data["json"] = code.Code{
+			Success: true,
+			Status: http.StatusOK,
+			Message: "鎺ㄩ�佸畬鎴�",
+			Data: managerMsg,
+		}
+	} else {
+		c.Data["json"] = code.Code{
+			Success: true,
+			Status: http.StatusOK,
+			Message: "鏃犻渶鎺ㄩ�侊紝褰撳墠鍋滅暀杞﹁締淇℃伅涓虹┖",
+		}
+	}
+
+	c.ServeJSON()
+}
 // @router /spaceInfo [get]
 func (c *CarController) SpaceInfo() {
+	userId := c.GetString("userId")
 	sv := service.NewCarService()
-	spaceInfo := sv.FindHikSpaceInfo()
+	spaceInfo := sv.FindHikSpaceInfo(userId)
 	c.Data["json"] = code.Code{
 		Success: true,
 		Status: http.StatusOK,
@@ -233,6 +295,19 @@
 	c.ServeJSON()
 }
 
+// @router /spaceUser [get]
+func (c *CarController) SpaceUser() {
+	userId := c.GetString("userId")
+	sv := service.NewCarService()
+	spaceUser := sv.FindHikSpaceUser(userId)
+	c.Data["json"] = code.Code{
+		Success: true,
+		Status: http.StatusOK,
+		Data: spaceUser,
+	}
+	c.ServeJSON()
+}
+
 // @router /pushLog [get]
 func (c *CarController) PushLog() {
 	st := c.GetString("startTime")

--
Gitblit v1.8.0