浏览代码

推送图片测试3

locky 3 年之前
父节点
当前提交
6e4c2dfd3e
共有 2 个文件被更改,包括 4 次插入3 次删除
  1. 0 1
      Controller/gatewayController.py
  2. 4 2
      Service/GatewayService.py

+ 0 - 1
Controller/gatewayController.py

@@ -170,7 +170,6 @@ class GatewayView(View):
                             kwargs['launch_image'] = 'https://d2cjxvw3tr9apc.cloudfront.net/app/push_images/智能按钮.228.png'
                             GatewayPushService.ios_apns_push(**kwargs)
                         elif push_type == 1:  # android gcm
-                            kwargs['image'] = 'https://d2cjxvw3tr9apc.cloudfront.net/app/push_images/智能按钮.228.png'
                             GatewayPushService.android_fcm_push(**kwargs)
                         elif push_type == 2:  # android 极光推送
                             GatewayPushService.android_jpush(**kwargs)

+ 4 - 2
Service/GatewayService.py

@@ -57,7 +57,7 @@ class GatewayPushService:
 
     # android fcm 推送
     @staticmethod
-    def android_fcm_push(nickname, app_bundle_id, token_val, n_time, event_type, msg_title, msg_text, image):
+    def android_fcm_push(nickname, app_bundle_id, token_val, n_time, event_type, msg_title, msg_text, image=''):
         try:
             serverKey = FCM_CONFIG[app_bundle_id]
             push_service = FCMNotification(api_key=serverKey)
@@ -66,10 +66,12 @@ class GatewayPushService:
                          }
             result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
                                                        message_body=msg_text, data_message=push_data,
+                                                       extra_notification_kwargs={
+                                                           'image': image
+                                                       },
                                                        extra_kwargs={'default_sound': True,
                                                                      'default_vibrate_timings': True,
                                                                      'default_light_settings': True,
-                                                                     'image': image,
                                                                      }
                                                        )
             return result