|
@@ -128,9 +128,11 @@ class PushObject:
|
|
|
try:
|
|
|
cli = apns2.APNSClient(mode=APNS_MODE, client_cert=pem_path)
|
|
|
alert = apns2.PayloadAlert(title=msg_title, body=msg_text, launch_image=launch_image)
|
|
|
+ # 跳转类型,1:推送消息,2:系统消息,3:音视频通话消息
|
|
|
+ jump_type = CommonService.get_jump_type(event_type)
|
|
|
push_data = {'alert': msg_text, 'msg': '', 'sound': '', 'zpush': '1', 'uid': uid, 'channel': channel,
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
- 'image_url': launch_image
|
|
|
+ 'image_url': launch_image, 'jump_type': jump_type
|
|
|
}
|
|
|
sound = 'call_phone.mp3' if event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value else 'default'
|
|
|
payload = apns2.Payload(alert=alert, custom=push_data, sound=sound, category='myCategory',
|
|
@@ -207,9 +209,11 @@ class PushObject:
|
|
|
try:
|
|
|
event_type = str(event_type)
|
|
|
n_time = str(n_time)
|
|
|
+ # 跳转类型
|
|
|
+ jump_type = CommonService.get_jump_type(event_type)
|
|
|
push_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
- 'uid': uid, 'channel': channel
|
|
|
+ 'uid': uid, 'channel': channel, 'jump_type': jump_type
|
|
|
}
|
|
|
if event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
|
push_data['priority'] = 'high'
|
|
@@ -299,9 +303,11 @@ class PushObject:
|
|
|
channel_id = '111934'
|
|
|
else:
|
|
|
channel_id = '1'
|
|
|
+ # 跳转类型
|
|
|
+ jump_type = CommonService.get_jump_type(event_type)
|
|
|
push_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'uid': nickname,
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
- 'channel': channel
|
|
|
+ 'channel': channel, 'jump_type': jump_type
|
|
|
}
|
|
|
android = jpush.android(title=msg_title, big_text=msg_text, alert=msg_text, extras=push_data,
|
|
|
priority=1, style=1, alert_type=7, channel_id=channel_id
|
|
@@ -401,9 +407,11 @@ class PushObject:
|
|
|
# 鉴权接口调用获得authToken
|
|
|
sender_send = APISender(app_secret)
|
|
|
sender_send.set_token(rec['authToken'])
|
|
|
+ # 跳转类型
|
|
|
+ jump_type = CommonService.get_jump_type(event_type)
|
|
|
push_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'image': image,
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
- 'uid': uid, 'channel': channel
|
|
|
+ 'uid': uid, 'channel': channel, 'jump_type': jump_type
|
|
|
}
|
|
|
# 获取唯一标识符
|
|
|
uid_push_qs = UidPushModel.objects.filter(token_val=token_val).values('m_code')
|
|
@@ -533,9 +541,11 @@ class PushObject:
|
|
|
appId = MEIZUPUSH_CONFIG[app_bundle_id]['ID']
|
|
|
appSecret = MEIZUPUSH_CONFIG[app_bundle_id]['AppSecret']
|
|
|
url = 'https://server-api-push.meizu.com/garcia/api/server/push/varnished/pushByPushId'
|
|
|
+ # 跳转类型
|
|
|
+ jump_type = CommonService.get_jump_type(event_type)
|
|
|
extra_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
- 'uid': uid, 'channel': channel
|
|
|
+ 'uid': uid, 'channel': channel, 'jump_type': jump_type
|
|
|
}
|
|
|
# 转换为json格式
|
|
|
extra_data = json.dumps(extra_data)
|
|
@@ -609,10 +619,12 @@ class PushObject:
|
|
|
push_url = 'https://push-api.cloud.hihonor.com/api/v1/{}/sendMessage'.format(app_id)
|
|
|
headers = {'Content-Type': 'application/json', 'Authorization': authorization_token,
|
|
|
'timestamp': str(int(time.time()) * 1000)}
|
|
|
+ # 跳转类型
|
|
|
+ jump_type = CommonService.get_jump_type(event_type)
|
|
|
extra_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
'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
|
|
|
+ 'nickname': nickname, 'uid': uid, 'channel': channel, 'title': msg_title, 'body': msg_text,
|
|
|
+ 'jump_type': jump_type
|
|
|
}
|
|
|
# 通知推送
|
|
|
push_data = {
|