瀏覽代碼

ansjerpush

chenjunkai 5 年之前
父節點
當前提交
8019f4aaf6
共有 1 個文件被更改,包括 11 次插入4 次删除
  1. 11 4
      Controller/DetectController.py

+ 11 - 4
Controller/DetectController.py

@@ -208,7 +208,7 @@ class NotificationView(View):
             return True
         return False
 
-    def get_msg_text(self, channel, n_time, lang, tz, event_type):
+    def get_msg_text(self, channel, n_time, lang, tz, event_type,is_sys=0):
         n_date = CommonService.get_now_time_str(n_time=n_time, tz=tz)
         etype = int(event_type)
         if lang == 'cn':
@@ -220,7 +220,10 @@ class NotificationView(View):
                 msg_type = '摄像头唤醒'
             else:
                 msg_type = ''
-            send_text = '{msg_type} 通道:{channel} 日期:{date}'.format(msg_type=msg_type, channel=channel, date=n_date)
+            if is_sys:
+                send_text = '{msg_type} 通道:{channel}'.format(msg_type=msg_type, channel=channel)
+            else:
+                send_text = '{msg_type} 通道:{channel} 日期:{date}'.format(msg_type=msg_type, channel=channel, date=n_date)
         else:
             if etype == 704:
                 msg_type = 'Low battery'
@@ -230,8 +233,12 @@ class NotificationView(View):
                 msg_type = 'Camera wake'
             else:
                 msg_type = ''
-            send_text = '{msg_type} channel:{channel} date:{date}'. \
-                format(msg_type=msg_type, channel=channel, date=n_date)
+            if is_sys:
+                send_text = '{msg_type} channel:{channel}'. \
+                    format(msg_type=msg_type, channel=channel)
+            else:
+                send_text = '{msg_type} channel:{channel} date:{date}'. \
+                    format(msg_type=msg_type, channel=channel, date=n_date)
         return send_text
 
     def do_jpush(self, uid, channel, appBundleId, token_val, event_type, n_time,