Преглед изворни кода

oppo推送添加通知通道

peng пре 2 година
родитељ
комит
a60fdab7ab

+ 2 - 1
Controller/ComboCron/ComboCronPushController.py

@@ -242,7 +242,8 @@ class ComboCronPushView(View):
                 PushObject.android_vivopush(**kwargs)
             # android oppo推送
             elif push_type == 6:
-                PushObject.android_oppopush(**kwargs)
+                channel_id = 'VALUE_ADDED'
+                PushObject.android_oppopush(channel_id=channel_id, **kwargs)
             # android 魅族推送
             elif push_type == 7:
                 PushObject.android_meizupush(**kwargs)

+ 2 - 1
Controller/PowerWarningController.py

@@ -101,7 +101,8 @@ class PowerWarningView(View):
                     elif push_type == 5:  # android vivo推送
                         PushObject.android_vivopush(**kwargs)
                     elif push_type == 6:  # android oppo推送
-                        PushObject.android_oppopush(**kwargs)
+                        channel_id = 'VALUE_ADDED'
+                        PushObject.android_oppopush(channel_id=channel_id, **kwargs)
                     elif push_type == 7:  # android 魅族推送
                         PushObject.android_meizupush(**kwargs)
                 except Exception as e:

+ 4 - 2
Controller/gatewayController.py

@@ -187,7 +187,8 @@ class GatewayView(View):
                         elif push_type == 5:  # android vivo推送
                             PushObject.android_vivopush(**kwargs)
                         elif push_type == 6:  # android oppo推送
-                            PushObject.android_oppopush(**kwargs)
+                            channel_id = 'DEVICE_REMINDER'
+                            PushObject.android_oppopush(channel_id=channel_id, **kwargs)
                         elif push_type == 7:  # android 魅族推送
                             PushObject.android_meizupush(**kwargs)
                     except Exception as e:
@@ -289,7 +290,8 @@ class GatewayView(View):
                             elif push_type == 5:  # android vivo推送
                                 PushObject.android_vivopush(**kwargs)
                             elif push_type == 6:  # android oppo推送
-                                PushObject.android_oppopush(**kwargs)
+                                channel_id = 'DEVICE_REMINDER'
+                                PushObject.android_oppopush(channel_id=channel_id, **kwargs)
                             elif push_type == 7:  # android 魅族推送
                                 PushObject.android_meizupush(**kwargs)
                         except Exception as e:

+ 5 - 3
Service/DevicePushService.py

@@ -199,7 +199,8 @@ class DevicePushService:
                     elif push_type == 5:  # android vivopush
                         result['do_vivopush_code'] = PushObject.android_vivopush(**kwargs)
                     elif push_type == 6:  # android oppopush
-                        result['do_oppopush_code'] = cls.do_oppopush(**kwargs)
+                        channel_id = 'DEVICE_REMINDER'
+                        result['do_oppopush_code'] = cls.do_oppopush(channel_id=channel_id, **kwargs)
                     elif push_type == 7:  # android meizupush
                         result['do_meizupush_code'] = PushObject.android_meizupush(**kwargs)
             return result
@@ -404,8 +405,8 @@ class DevicePushService:
         if response.status_code == 200:
             return response.json()
 
-    @classmethod
-    def do_oppopush(cls, uid, channel, appBundleId, token_val, event_type, n_time,
+    @staticmethod
+    def do_oppopush(channel_id, uid, channel, appBundleId, token_val, event_type, n_time,
                     msg_title, msg_text):
         """
         android 国内oppo APP消息提醒推送
@@ -441,6 +442,7 @@ class DevicePushService:
             "notification": {
                 "title": msg_title,
                 "content": msg_text,
+                'channel_id': channel_id
             }
         }
         push_data = {

+ 3 - 1
Service/PushService.py

@@ -311,10 +311,11 @@ class PushObject:
             logger.info('vivo推送异常:{}'.format(e))
 
     @staticmethod
-    def android_oppopush(nickname, app_bundle_id, token_val, n_time, event_type, msg_title, msg_text,
+    def android_oppopush(channel_id, nickname, app_bundle_id, token_val, n_time, event_type, msg_title, msg_text,
                          uid='', channel='1', image=''):
         """
         android oppo 推送
+        @param channel_id: 通知通道id
         @param nickname: 设备昵称
         @param app_bundle_id: app包id
         @param token_val: 推送token
@@ -364,6 +365,7 @@ class PushObject:
                 "notification": {
                     "title": msg_title,
                     "content": msg_text,
+                    'channel_id': channel_id
                 }
             }
             push_data = {