From d36e0b699b56d5b6fb0abf30508b94c98b4b28ca Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期一, 07 九月 2020 10:34:19 +0800
Subject: [PATCH] push2Manager at 22:30,android msg use big_text
---
service/msgPush.go | 1 +
controllers/car.go | 47 +++++++++++++++++++++++++----------------------
2 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/controllers/car.go b/controllers/car.go
index 5dd901c..22aeaa6 100644
--- a/controllers/car.go
+++ b/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,25 +119,28 @@
logE.Insert()
fmt.Println("b:", b,"e:",e, "message:", message)
- //灏嗗叿浣撶殑杞︿富淇℃伅鎺ㄩ�佺粰绠$悊鍛�
- if carOwnNames != nil && len(carOwnNames) >0 {
- //鑾峰彇杞︿富濮撳悕
- managerMsg := fmt.Sprintf("%s 鏈┒绂昏溅涓�: %s", time.Now().Format("2006-01-02 15:04:05"), strings.Join(carOwnNames, " "))
- mb,me, managerArr := service.Push2Manager("鑲茶嫳涓鍋滆溅", managerMsg)
- mLogE := models.Log{
- Id: uuid.NewV4().String(),
- CreateTime: time.Now().Format("2006-01-02 15:04:05"),
- Result: mb,
- Phones: strings.Join(managerArr, ","),
+ if curTimes == 3 { //鍙粰绠$悊鍛樻帹閫佷竴娆¤繖涓秷鎭�
+ //灏嗗叿浣撶殑杞︿富淇℃伅鎺ㄩ�佺粰绠$悊鍛�
+ if carOwnNames != nil && len(carOwnNames) >0 {
+ //鑾峰彇杞︿富濮撳悕
+ managerMsg := fmt.Sprintf("%s 鏈┒绂昏溅涓�: %s", time.Now().Format("2006-01-02 15:04:05"), strings.Join(carOwnNames, " "))
+ mb,me, managerArr := service.Push2Manager("鑲茶嫳涓鍋滆溅", managerMsg)
+ 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)
}
- if me != nil {
- mLogE.Content = me.Error()
- } else {
- mLogE.Content = managerMsg
- }
- mLogE.Insert()
- fmt.Println("mb:", mb, "me:", me, "message:", managerMsg)
}
+
}
var cacheSpaceLeft int
diff --git a/service/msgPush.go b/service/msgPush.go
index b87dd58..4b2d58d 100644
--- a/service/msgPush.go
+++ b/service/msgPush.go
@@ -186,6 +186,7 @@
"notification": {
"title": title,
"body": msg,
+ "big_text": msg,
"click_type": "intent",
"intent": intent,
},
--
Gitblit v1.8.0