From f58d6c7e121dc6a16f6b1e12e5beba1e6ce1b992 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期二, 08 九月 2020 15:11:05 +0800 Subject: [PATCH] Push2Manager add isTest --- service/msgPush.go | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/service/msgPush.go b/service/msgPush.go index 7f19c39..da1455a 100644 --- a/service/msgPush.go +++ b/service/msgPush.go @@ -184,6 +184,7 @@ androidPush := map[string]map[string]map[string]string { "ups": { "notification": { + "title": title, "body": msg, "big_text": msg, "click_type": "intent", @@ -193,8 +194,10 @@ } iosPush := map[string]interface{}{ "type":"notify", + "payload": "鑲茶嫳涓鍋滆溅", "aps":map[string]interface{}{ "alert":map[string]string{ + "title": title, "body": msg, }, "content-available":0, @@ -207,6 +210,7 @@ }, "push_message": map[string]map[string]string { "notification": { + "title": title, "body": msg, "click_type": "intent", "intent": intent, @@ -557,10 +561,14 @@ if personId,ok := carPersonM[inCnPlateNo];ok { if v,ex := hikPersonMap[personId]; ex { - carOwners = append(carOwners, v.PersonName) + carOwners = append(carOwners, sn.PlateNo+"("+v.PersonName+")") } } else { //鎵句笉鍒拌溅涓伙紝鍗宠涓轰复鏃惰溅锛屽皢杞︾墝浣滀负杞︿富濮撳悕鎺ㄩ�� - carOwners = append(carOwners, sn.PlateNo) + if sn.PlateNo == "鏃犺溅鐗�" { + carOwners = append(carOwners, sn.PlateNo) + } else { + carOwners = append(carOwners, sn.PlateNo+"()") + } } } } @@ -585,14 +593,19 @@ } //濡傛灉澶滈棿鏈夌粰杞﹀簱鍐呯殑杞︿富鎺ㄩ�佲�滆灏藉揩椹剁鈥濈殑娑堟伅锛屽垯鍛婄煡绠$悊鍛� 鏈夊摢浜涜溅灏氬仠鍦ㄨ溅搴撳唴 -func Push2Manager(title string, msg string) (bool, error, []string) { +func Push2Manager(title string, msg string, isTest bool) (bool, error, []string) { if len(msg) > 256 { fmt.Println("澶滈棿鍋滅暀杞﹀お澶氾紝message:", msg) r := []rune(msg) msg = string(r[:125])+"..." } - managers := beego.AppConfig.String("nightManagerPhones") + managers := "" + if isTest { + managers = beego.AppConfig.String("testPushPhones") + } else { + managers = beego.AppConfig.String("nightManagerPhones") + } if managers == "" { return false, errors.New("澶滈棿鎺ㄩ�佺鐞嗗憳鎵嬫満鍙锋湭閰嶇疆"), []string{} } -- Gitblit v1.8.0