|
@@ -522,32 +522,31 @@ class PushObject:
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': str(event_type), 'nickname': nickname,
|
|
|
'uid': uid, 'channel': channel, 'title': msg_title, 'body': msg_text
|
|
|
}
|
|
|
- LOGGER.info('荣耀推送event_type:{},token_val:{}'.format(event_type, token_val))
|
|
|
- # 一键通话通知推送
|
|
|
- if int(event_type) in [606, 607]:
|
|
|
- push_data = {
|
|
|
- "android": {
|
|
|
- "notification": {
|
|
|
- "body": msg_text,
|
|
|
- "title": msg_title,
|
|
|
- "clickAction": {
|
|
|
- "type": 3
|
|
|
- }
|
|
|
+ # 通知推送
|
|
|
+ push_data = {
|
|
|
+ "android": {
|
|
|
+ "notification": {
|
|
|
+ "body": msg_text,
|
|
|
+ "title": msg_title,
|
|
|
+ "clickAction": {
|
|
|
+ "type": 3
|
|
|
}
|
|
|
},
|
|
|
- "token": [token_val]
|
|
|
- }
|
|
|
- response = requests.post(push_url, json=push_data, headers=headers)
|
|
|
- LOGGER.info("uid:{},时间:{},荣耀通知推送返回值:{}, authorization_token:{}".format(
|
|
|
- uid, n_time, response.json(), authorization_token))
|
|
|
-
|
|
|
- # 透传推送
|
|
|
- push_data = {
|
|
|
- "data": json.dumps(extra_data),
|
|
|
+ "targetUserType": 1,
|
|
|
+ "data": json.dumps(extra_data)
|
|
|
+ },
|
|
|
"token": [token_val]
|
|
|
}
|
|
|
response = requests.post(push_url, json=push_data, headers=headers)
|
|
|
- LOGGER.info("uid:{},时间:{},荣耀透传推送返回值:{}".format(uid, n_time, response.json()))
|
|
|
+ LOGGER.info("uid:{},时间:{},荣耀推送通知返回值:{}".format(uid, n_time, response.json()))
|
|
|
+ # 一键通话透传推送
|
|
|
+ if int(event_type) in [606, 607]:
|
|
|
+ push_data = {
|
|
|
+ "data": json.dumps(extra_data),
|
|
|
+ "token": [token_val]
|
|
|
+ }
|
|
|
+ response = requests.post(push_url, json=push_data, headers=headers)
|
|
|
+ LOGGER.info("uid:{},时间:{},荣耀透传推送返回值:{}".format(uid, n_time, response.json()))
|
|
|
return True
|
|
|
except Exception as e:
|
|
|
LOGGER.info("荣耀推送异常:error_line:{},error_msg:{}".format(e.__traceback__.tb_lineno, repr(e)))
|