Forráskód Böngészése

修改click_action

locky 2 éve
szülő
commit
cecf66c3b9
1 módosított fájl, 8 hozzáadás és 8 törlés
  1. 8 8
      Service/HuaweiPushService/HuaweiPushService.py

+ 8 - 8
Service/HuaweiPushService/HuaweiPushService.py

@@ -65,14 +65,14 @@ class HuaweiPushObject:
         )
 
         # 自定义键值对
-        data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'type': 1, 'uid': uid,
-                'nickname': nickname, 'event_type': event_type, 'received_at': n_time, 'event_time': n_time,
-                'intent': 'intent://com.vivo.pushvideo/detail?#Intent;scheme=vpushscheme;launchFlags=0x10000000;S.uid={};S.event_type={};S.event_time={};end'.format(
-                    uid, event_type, n_time)
+        data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'uid': uid,
+                'nickname': nickname, 'event_type': event_type, 'received_at': n_time, 'event_time': n_time
                 }
         data = json.dumps(data)
         # 推送通知内容配置
-        android_notification = self.android_notification(msg_title, msg_text)
+        intent = 'intent://com.vivo.pushvideo/detail?#Intent;scheme=vpushscheme;launchFlags=0x10000000;S.uid={};S.event_type={};S.event_time={};end'.format(
+            uid, event_type, n_time)
+        android_notification = self.android_notification(msg_title, msg_text, intent)
         # 安卓配置
         android = messaging.AndroidConfig(
             data=data,
@@ -133,7 +133,7 @@ class HuaweiPushObject:
             logger.info('华为透传推送异常: {}'.format(repr(e)))
 
     @staticmethod
-    def android_notification(msg_title, msg_text):
+    def android_notification(msg_title, msg_text, intent):
         return messaging.AndroidNotification(
             icon='/raw/ic_launcher2',
             color='#AACCDD',
@@ -141,8 +141,8 @@ class HuaweiPushObject:
             default_sound=True,
             click_action=messaging.AndroidClickAction(
                 action_type=1,
-                intent='intent://com.huawei.codelabpush/deeplink?#Intent;scheme=pushscheme;launchFlags=0x4000000;i.age=180;S.name=abc;end',
-                action='android.intent.action.VIEW'),
+                intent=intent
+            ),
             body_loc_key='M.String.body',
             body_loc_args=('boy', 'dog'),
             title_loc_key='M.String.title',