Jelajahi Sumber

小米推送添加通知通道

peng 2 tahun lalu
induk
melakukan
3cd64ff40c

+ 2 - 1
Controller/ComboCron/ComboCronPushController.py

@@ -235,7 +235,8 @@ class ComboCronPushView(View):
                 huawei_push_object.send_push_notify_message(**kwargs)
             # android 小米推送
             elif push_type == 4:
-                PushObject.android_xmpush(**kwargs)
+                channel_id = 104552
+                PushObject.android_xmpush(channel_id=channel_id, **kwargs)
             # android vivo推送
             elif push_type == 5:
                 PushObject.android_vivopush(**kwargs)

+ 2 - 1
Controller/PowerWarningController.py

@@ -96,7 +96,8 @@ class PowerWarningView(View):
                         huawei_push_object = HuaweiPushObject()
                         huawei_push_object.send_push_notify_message(**kwargs)
                     elif push_type == 4:  # android 小米推送
-                        PushObject.android_xmpush(**kwargs)
+                        channel_id = 104551
+                        PushObject.android_xmpush(channel_id=channel_id, **kwargs)
                     elif push_type == 5:  # android vivo推送
                         PushObject.android_vivopush(**kwargs)
                     elif push_type == 6:  # android oppo推送

+ 4 - 2
Controller/gatewayController.py

@@ -182,7 +182,8 @@ class GatewayView(View):
                             huawei_push_object = HuaweiPushObject()
                             huawei_push_object.send_push_notify_message(**kwargs)
                         elif push_type == 4:  # android 小米推送
-                            PushObject.android_xmpush(**kwargs)
+                            channel_id = 104551
+                            PushObject.android_xmpush(channel_id=channel_id, **kwargs)
                         elif push_type == 5:  # android vivo推送
                             PushObject.android_vivopush(**kwargs)
                         elif push_type == 6:  # android oppo推送
@@ -283,7 +284,8 @@ class GatewayView(View):
                                 huawei_push_object = HuaweiPushObject()
                                 huawei_push_object.send_push_notify_message(**kwargs)
                             elif push_type == 4:  # android 小米推送
-                                PushObject.android_xmpush(**kwargs)
+                                channel_id = 104551
+                                PushObject.android_xmpush(channel_id=channel_id, **kwargs)
                             elif push_type == 5:  # android vivo推送
                                 PushObject.android_vivopush(**kwargs)
                             elif push_type == 6:  # android oppo推送

+ 4 - 2
Service/DevicePushService.py

@@ -194,7 +194,8 @@ class DevicePushService:
                         huawei_push_object = HuaweiPushObject()
                         huawei_push_object.send_push_notify_message(**kwargs)
                     elif push_type == 4:  # android xmpush
-                        result['do_xmpush_code'] = cls.do_xmpush(**kwargs)
+                        channel_id = 104551
+                        result['do_xmpush_code'] = cls.do_xmpush(channel_id=channel_id, **kwargs)
                     elif push_type == 5:  # android vivopush
                         result['do_vivopush_code'] = PushObject.android_vivopush(**kwargs)
                     elif push_type == 6:  # android oppopush
@@ -376,7 +377,7 @@ class DevicePushService:
             return repr(e)
 
     @staticmethod
-    def do_xmpush(uid, channel, appBundleId, token_val, event_type, n_time,
+    def do_xmpush(channel_id, uid, channel, appBundleId, token_val, event_type, n_time,
                   msg_title, msg_text):
         """
         android 国内小米APP消息提醒推送
@@ -393,6 +394,7 @@ class DevicePushService:
             'payload': 'payload',
             'restricted_package_name': appBundleId,
             'registration_id': token_val,
+            'extra.channel_id': channel_id
         }
 
         headers = {

+ 2 - 1
Service/PushService.py

@@ -206,7 +206,7 @@ class PushObject:
             return repr(e)
 
     @staticmethod
-    def android_xmpush(nickname, app_bundle_id, token_val, n_time, event_type, msg_title, msg_text,
+    def android_xmpush(channel_id, nickname, app_bundle_id, token_val, n_time, event_type, msg_title, msg_text,
                        uid='', channel='1', image=''):
         """
         android 小米 推送
@@ -236,6 +236,7 @@ class PushObject:
                 'payload': 'payload',
                 'restricted_package_name': app_bundle_id,
                 'registration_id': token_val,
+                'extra.channel_id': channel_id
             }
             # if image:
             #     data['extra.notification_style_type'] = 2