浏览代码

谷歌推送增加channel_id

peng 2 年之前
父节点
当前提交
7f0a33e5d0
共有 2 个文件被更改,包括 5 次插入3 次删除
  1. 3 2
      Service/DevicePushService.py
  2. 2 1
      Service/PushService.py

+ 3 - 2
Service/DevicePushService.py

@@ -480,10 +480,11 @@ class DevicePushService:
             return 'serverKey abnormal'
         push_service = FCMNotification(api_key=serverKey)
         data = {"alert": "Motion ", "event_time": n_time, "event_type": event_type, "msg": "",
-                "received_at": n_time, "sound": "sound.aif", "uid": uid, "zpush": "1", "channel": channel,
-                'click_action': 'android.intent.action.VIEW'}
+                "received_at": n_time, "sound": "sound.aif", "uid": uid, "zpush": "1", "channel": channel
+                }
         result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
                                                    message_body=msg_text, data_message=data,
+                                                   click_action='android.intent.action.VIEW',
                                                    extra_kwargs={
                                                        'default_vibrate_timings': True,
                                                        'default_sound': True,

+ 2 - 1
Service/PushService.py

@@ -159,10 +159,11 @@ class PushObject:
             push_service = FCMNotification(api_key=serverKey)
             push_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'image': image,
                          'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
-                         'uid': uid, 'channel': channel, 'click_action': 'android.intent.action.VIEW'
+                         'uid': uid, 'channel': channel
                          }
             result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
                                                        message_body=msg_text, data_message=push_data,
+                                                       click_action='android.intent.action.VIEW',
                                                        extra_kwargs={'default_sound': True,
                                                                      'default_vibrate_timings': True,
                                                                      'default_light_settings': True,