Преглед на файлове

谷歌推送增加channel_id

peng преди 2 години
родител
ревизия
bf4e5fa614
променени са 2 файла, в които са добавени 3 реда и са изтрити 4 реда
  1. 2 2
      Service/DevicePushService.py
  2. 1 2
      Service/PushService.py

+ 2 - 2
Service/DevicePushService.py

@@ -480,14 +480,14 @@ 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}
+                "received_at": n_time, "sound": "sound.aif", "uid": uid, "zpush": "1", "channel": channel,
+                'click_action': 'android.intent.action.VIEW'}
         result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
                                                    message_body=msg_text, data_message=data,
                                                    extra_kwargs={
                                                        'default_vibrate_timings': True,
                                                        'default_sound': True,
                                                        'default_light_settings': True,
-                                                       'click_action': 'android.intent.action.VIEW'
                                                    },
                                                    )
         return result

+ 1 - 2
Service/PushService.py

@@ -159,14 +159,13 @@ 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
+                         'uid': uid, 'channel': channel, 'click_action': 'android.intent.action.VIEW'
                          }
             result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
                                                        message_body=msg_text, data_message=push_data,
                                                        extra_kwargs={'default_sound': True,
                                                                      'default_vibrate_timings': True,
                                                                      'default_light_settings': True,
-                                                                     'click_action': 'android.intent.action.VIEW'
                                                                      },
                                                        )
             logger.info('fcm推送结果:{}'.format(result))