From 368a1fd62952b40c8104d89464f525763250739e Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期三, 09 九月 2020 10:37:39 +0800
Subject: [PATCH] add pushOpen switch
---
conf/app.conf | 1 +
service/msgPush.go | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/conf/app.conf b/conf/app.conf
index a73f971..e7b3f32 100644
--- a/conf/app.conf
+++ b/conf/app.conf
@@ -20,6 +20,7 @@
hikAppSecret = ZHhxujl06e0e5jsJLaiB
pushLowerLimit = 5
initPushLeft = 88
+pushOpen = false
testPushPhones = 18601263339
nightManagerPhones = 15210613764,19821586309,13611298216,13693616515
nightVipPlateNos = 浜琇AK619,浜琋K00M0,浜琈R5102,浜琀94985
\ No newline at end of file
diff --git a/service/msgPush.go b/service/msgPush.go
index da1455a..52c7578 100644
--- a/service/msgPush.go
+++ b/service/msgPush.go
@@ -262,6 +262,9 @@
//瀵瑰凡娉ㄥ唽鐨勭敤鎴疯繘琛屾秷鎭帹閫併�傝皟鐢ㄦ鎺ュ彛鍓嶉渶璋冪敤鍒涘缓娑堟伅鎺ュ彛璁剧疆娑堟伅鍐呭
func PushByAlias(title string, msg string, isTest bool) (bool, error, []string) {
+ if !isPushOpen() {
+ return false,errors.New("鎺ㄩ�佸紑鍏冲凡鍏抽棴"),nil
+ }
var aliasArr []string
pushUserM := make(map[string]string)
@@ -426,6 +429,9 @@
}
func NightPush(title string, msg string) (bool, error, []string, []string) {
+ if !isPushOpen() {
+ return false,errors.New("鎺ㄩ�佸紑鍏冲凡鍏抽棴"),nil,nil
+ }
var aliasArr []string
var carOwners []string
@@ -594,6 +600,9 @@
//濡傛灉澶滈棿鏈夌粰杞﹀簱鍐呯殑杞︿富鎺ㄩ�佲�滆灏藉揩椹剁鈥濈殑娑堟伅锛屽垯鍛婄煡绠$悊鍛� 鏈夊摢浜涜溅灏氬仠鍦ㄨ溅搴撳唴
func Push2Manager(title string, msg string, isTest bool) (bool, error, []string) {
+ if !isPushOpen() {
+ return false,errors.New("鎺ㄩ�佸紑鍏冲凡鍏抽棴"),nil
+ }
if len(msg) > 256 {
fmt.Println("澶滈棿鍋滅暀杞﹀お澶氾紝message:", msg)
@@ -625,6 +634,15 @@
return b,e, managerArr
}
+func isPushOpen() bool {
+ b, err := beego.AppConfig.Bool("pushOpen")
+ fmt.Println("pushOpen:", b, "err:", err)
+ if err != nil {
+ return false
+ }
+ return b
+}
+
/*
func PushAll(title string, msg string) (bool,error) {
appId := beego.AppConfig.String("pushAppId")
--
Gitblit v1.8.0