Bläddra i källkod

推送图片测试

locky 3 år sedan
förälder
incheckning
ccfd321e8b
2 ändrade filer med 3 tillägg och 6 borttagningar
  1. 2 2
      Controller/DetectControllerV2.py
  2. 1 4
      Service/GatewayService.py

+ 2 - 2
Controller/DetectControllerV2.py

@@ -246,8 +246,8 @@ class NotificationView(View):
                     if not have_dkey:
                         logger.info('准备推送:{}, {}'.format(uid, request_dict))
                         # if (is_st == 1 or is_st == 3) and (push_type == 0 or push_type == 1):
-                        # push_thread = threading.Thread(target=self.push_thread_test, args=(push_type, aws_s3_client, uid, appBundleId, token_val, event_type, n_time, msg_title, msg_text))
-                        # push_thread.start()
+                        push_thread = threading.Thread(target=self.push_thread_test, args=(push_type, aws_s3_client, uid, appBundleId, token_val, event_type, n_time, msg_title, msg_text))
+                        push_thread.start()
                         if push_type == 0:  # ios apns
                             do_apns_code = self.do_apns(**kwag_args)
                             logger.info('进入do_apns,uid={}'.format(uid))

+ 1 - 4
Service/GatewayService.py

@@ -62,14 +62,11 @@ class GatewayPushService:
         try:
             serverKey = FCM_CONFIG[app_bundle_id]
             push_service = FCMNotification(api_key=serverKey)
-            push_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
+            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
                          }
             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,