Browse Source

gcm 推送图片

locky 3 years ago
parent
commit
5e4c1c59c0
2 changed files with 4 additions and 2 deletions
  1. 2 1
      Controller/gatewayController.py
  2. 2 1
      Service/GatewayService.py

+ 2 - 1
Controller/gatewayController.py

@@ -165,13 +165,14 @@ class GatewayView(View):
                     kwargs['msg_text'] = msg_text
                     kwargs['app_bundle_id'] = app_bundle_id
                     kwargs['token_val'] = token_val
-                    kwargs['launch_image'] = 'https://d2cjxvw3tr9apc.cloudfront.net/app/push_images/ipad-icon-40.png'
 
                     try:
                         # 推送消息
                         if push_type == 0:  # ios apns
+                            kwargs['launch_image'] = 'https://d2cjxvw3tr9apc.cloudfront.net/app/push_images/智能按钮.228.png'
                             GatewayPushService.ios_apns_push(**kwargs)
                         elif push_type == 1:  # android gcm
+                            kwargs['message_icon'] = 'https://d2cjxvw3tr9apc.cloudfront.net/app/push_images/智能按钮.228.png'
                             GatewayPushService.android_fcm_push(**kwargs)
                         elif push_type == 2:  # android 极光推送
                             GatewayPushService.android_jpush(**kwargs)

+ 2 - 1
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):
+    def android_fcm_push(nickname, app_bundle_id, token_val, n_time, event_type, msg_title, msg_text, message_icon):
         try:
             serverKey = FCM_CONFIG[app_bundle_id]
             push_service = FCMNotification(api_key=serverKey)
@@ -66,6 +66,7 @@ class GatewayPushService:
                          }
             result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
                                                        message_body=msg_text, data_message=push_data,
+                                                       message_icon=message_icon,
                                                        extra_kwargs={'default_sound': True,
                                                                      'default_vibrate_timings': True,
                                                                      'default_light_settings': True