Browse Source

推送图片测试2

locky 3 years ago
parent
commit
e7379a1110
3 changed files with 6 additions and 6 deletions
  1. 2 2
      Controller/DetectControllerV2.py
  2. 1 1
      Controller/gatewayController.py
  3. 3 3
      Service/GatewayService.py

+ 2 - 2
Controller/DetectControllerV2.py

@@ -375,9 +375,9 @@ class NotificationView(View):
         logger.info('推送图片测试:{} {} {} {} {} {} {} {}'.format(push_type, uid, appBundleId, token_val, event_type, n_time, msg_title, msg_text))
         time.sleep(3)
         bucket = 'foreignpush'
-        thumbspng = '11PGLS16VTM7PZGP111A/1/1659484801.jpeg'
+        thumbspng = '11PGLS16VTM7PZGP111A/1/1660166702.jpeg'
         try:
-            image_url = aws_s3_client.generate_presigned_url('get_object', Params={'Bucket': bucket, 'Key': thumbspng}, ExpiresIn=300)
+            image_url = aws_s3_client.generate_presigned_url('get_object', Params={'Bucket': bucket, 'Key': thumbspng}, ExpiresIn=86400)
             logger.info('推送图片url:{}'.format(image_url))
             if push_type == 0:
                 GatewayPushService.ios_apns_push(uid, appBundleId, token_val, n_time, event_type, msg_title, msg_text, image_url)

+ 1 - 1
Controller/gatewayController.py

@@ -170,7 +170,7 @@ 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['message_icon'] = 'https://d2cjxvw3tr9apc.cloudfront.net/app/push_images/智能按钮.228.png'
+                            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)

+ 3 - 3
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, message_icon):
+    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,10 @@ 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
+                                                                     'default_light_settings': True,
+                                                                     'image': image,
                                                                      }
                                                        )
             return result