From 78177cc89c8340302bb0f3eb29504b1f62d8b00c Mon Sep 17 00:00:00 2001
From: 554325746@qq.com <554325746@qq.com>
Date: 星期一, 11 一月 2021 11:40:42 +0800
Subject: [PATCH] 无车牌不推送,表格中和车位数都不占用

---
 service/msgPush.go |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/service/msgPush.go b/service/msgPush.go
index da1455a..d07d3de 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
 
@@ -486,7 +492,8 @@
 						}
 					} else { //鎵句笉鍒拌溅涓伙紝鍗宠涓轰复鏃惰溅锛屽皢杞︾墝浣滀负杞︿富濮撳悕鎺ㄩ��
 						if sn.PlateNo == "鏃犺溅鐗�" {
-							carOwners = append(carOwners, sn.PlateNo)
+                            //鏃犺溅鐗岀殑涓嶆帹閫�
+							//carOwners = append(carOwners, sn.PlateNo)
 						} else {
 							carOwners = append(carOwners, sn.PlateNo+"()")
 						}
@@ -594,6 +601,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)
 
@@ -623,6 +633,15 @@
 
 	b,e := doPush(taskId, managerArr)
 	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
 }
 
 /*
@@ -751,4 +770,4 @@
 		return &t, nil
 	}
 	return nil, errors.New("鑾峰彇unipush骞冲彴token澶辫触")
-}
\ No newline at end of file
+}

--
Gitblit v1.8.0