瀏覽代碼

小米推送增加按钮

peng 2 年之前
父節點
當前提交
575b0c3d22
共有 2 個文件被更改,包括 18 次插入9 次删除
  1. 9 5
      Service/DevicePushService.py
  2. 9 4
      Service/PushService.py

+ 9 - 5
Service/DevicePushService.py

@@ -542,12 +542,16 @@ class DevicePushService:
             'extra.event_type': event_type,
             'extra.event_type': event_type,
             'extra.uid': uid,
             'extra.uid': uid,
             'extra.channel': channel,
             'extra.channel': channel,
-            'extra.notification_style_type': 1,
-            'extra.notification_style_button_left_name': 'left_button',
-            'extra.notification_style_button_left_notify_effect': 2,
-            'extra.notification_style_button_left_intent_class': 'com.ansjer.zccloud_a.AJ_MainView.AJ_Home.AJMainActivity'
         }
         }
-
+        if event_type in [606, 607]:
+            data['extra.notification_style_type'] = 1
+            data['extra.notification_style_button_left_name'] = '接听'
+            data['extra.notification_style_button_left_notify_effect'] = 2
+            data[
+                'extra.notification_style_button_left_intent_class'] = 'com.ansjer.zccloud_a.AJ_MainView.AJ_Home.AJMainActivity'
+            data['extra.notification_style_button_right_name'] = '挂断'
+            data['extra.notification_style_button_right_notify_effect'] = 2
+            data['extra.notification_style_button_right_intent_class'] = ''
         headers = {
         headers = {
             'Authorization': 'key={}'.format(app_secret)
             'Authorization': 'key={}'.format(app_secret)
         }
         }

+ 9 - 4
Service/PushService.py

@@ -262,11 +262,16 @@ class PushObject:
                 'extra.nickname': nickname,
                 'extra.nickname': nickname,
                 'extra.uid': uid,
                 'extra.uid': uid,
                 'extra.channel': channel,
                 'extra.channel': channel,
-                'extra.notification_style_type': 1,
-                'extra.notification_style_button_left_name': 'left_button',
-                'extra.notification_style_button_left_notify_effect': 2,
-                'extra.notification_style_button_left_intent_class': 'com.ansjer.zccloud_a.AJ_MainView.AJ_Home.AJMainActivity'
             }
             }
+            if event_type in [606, 607]:
+                data['extra.notification_style_type'] = 1
+                data['extra.notification_style_button_left_name'] = '接听'
+                data['extra.notification_style_button_left_notify_effect'] = 2
+                data[
+                    'extra.notification_style_button_left_intent_class'] = 'com.ansjer.zccloud_a.AJ_MainView.AJ_Home.AJMainActivity'
+                data['extra.notification_style_button_right_name'] = '挂断'
+                data['extra.notification_style_button_right_notify_effect'] = 2
+                data['extra.notification_style_button_right_intent_class'] = ''
             # if image:
             # if image:
             #     data['extra.notification_style_type'] = 2
             #     data['extra.notification_style_type'] = 2
             #     data['extra.notification_bigPic_uri'] = image
             #     data['extra.notification_bigPic_uri'] = image