Эх сурвалжийг харах

华为发送推送自定义键值对加上uid

locky 2 жил өмнө
parent
commit
cf545953e0

+ 11 - 11
Service/HuaweiPushService/HuaweiPushService.py

@@ -17,21 +17,21 @@ class HuaweiPushObject:
         """init sdk app"""
         push_admin.initialize_app(self.app_id, self.app_secret)
 
-    def send_push_notify_message(self, token_val, msg_title, msg_text, image_url=None, uid='', nickname='', channel='',
-                                 n_time='', event_type='', app_bundle_id='', appBundleId=''):
+    def send_push_notify_message(self, token_val, msg_title, msg_text, image_url=None, uid='', nickname='', n_time='',
+                                 event_type='', channel='', app_bundle_id='', appBundleId=''):
         """
         发送推送消息
         @param token_val: 手机推送token
         @param msg_title: 标题
         @param msg_text: 内容
-        @param n_time: 不使用
-        @param event_type: 不使用
-        @param app_bundle_id: 不使用
-        @param appBundleId: 不使用
-        @param uid: 不使用
-        @param channel: 不使用
-        @param msg_text: 不使用
         @param image_url: 图片链接
+        @param uid: uid
+        @param nickname: 设备昵称
+        @param n_time: 当前时间
+        @param event_type: 事件类型
+        @param channel: 通道
+        @param app_bundle_id: APP包id
+        @param appBundleId: APP包id
         @return:
         """
         logger = logging.getLogger('info')
@@ -45,8 +45,8 @@ class HuaweiPushObject:
         )
 
         # 自定义键值对
-        data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
-                'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname
+        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)
         # 推送通知内容配置