Ver código fonte

华为推送添加打印

locky 2 anos atrás
pai
commit
6919872e6e
1 arquivos alterados com 5 adições e 3 exclusões
  1. 5 3
      Service/HuaweiPushService/HuaweiPushService.py

+ 5 - 3
Service/HuaweiPushService/HuaweiPushService.py

@@ -39,7 +39,7 @@ class HuaweiPushObject:
                 token_val, msg_title, msg_text, image_url, uid, event_type, n_time))
 
         self.send_notify_message(msg_title, msg_text, image_url, uid, nickname, event_type, n_time, token_val)
-        if event_type == '606':
+        if int(event_type) == 606:
             self.send_data_message(uid, event_type, n_time, token_val)
 
     def send_notify_message(self, msg_title, msg_text, image_url, uid, nickname, event_type, n_time, token_val):
@@ -55,6 +55,7 @@ class HuaweiPushObject:
         @param token_val:
         @return: None
         """
+        LOGGER.info('{}进入发送通知推送函数'.format(uid))
         msg_title = '设备昵称: {}'.format(msg_title)
         notification = messaging.Notification(
             title=msg_title,
@@ -91,7 +92,7 @@ class HuaweiPushObject:
         try:
             import certifi
             response = messaging.send_message(message, verify_peer=certifi.where())
-            LOGGER.info('华为通知推送响应: {}'.format(json.dumps(vars(response))))
+            LOGGER.info('{}华为通知推送响应: {}'.format(uid, json.dumps(vars(response))))
             assert (response.code == '80000000')
         except Exception as e:
             LOGGER.info('华为通知推送异常: {}'.format(repr(e)))
@@ -106,6 +107,7 @@ class HuaweiPushObject:
         @param token_val:
         @return: None
         """
+        LOGGER.info('{}进入发送透传推送函数'.format(uid))
         data = {'uid': uid, 'event_type': event_type, 'event_time': n_time}
         data = json.dumps(data)
         android = messaging.AndroidConfig(
@@ -124,7 +126,7 @@ class HuaweiPushObject:
         try:
             import certifi
             response = messaging.send_message(message, verify_peer=certifi.where())
-            LOGGER.info('华为透传推送响应: {}'.format(json.dumps(vars(response))))
+            LOGGER.info('{}华为透传推送响应: {}'.format(uid, json.dumps(vars(response))))
             assert (response.code == '80000000')
         except Exception as e:
             LOGGER.info('华为透传推送异常: {}'.format(repr(e)))