liuxiaolong
2020-09-07 d36e0b699b56d5b6fb0abf30508b94c98b4b28ca
push2Manager at 22:30,android msg use big_text
2个文件已修改
48 ■■■■ 已修改文件
controllers/car.go 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/msgPush.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
service/msgPush.go
@@ -186,6 +186,7 @@
            "notification": {
                "title": title,
                "body": msg,
                "big_text": msg,
                "click_type": "intent",
                "intent": intent,
            },