|
@@ -108,7 +108,7 @@ class DevicePushService:
|
|
@param button: 按钮
|
|
@param button: 按钮
|
|
@return: uid_push_qs
|
|
@return: uid_push_qs
|
|
"""
|
|
"""
|
|
- if event_type not in [606, 607]:
|
|
|
|
|
|
+ if event_type not in EventTypeEnumObj.PRIMARY_USERS_PUSH_EVENT_TYPE_LIST.value:
|
|
uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=1) \
|
|
uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=1) \
|
|
.exclude(token_val='0'). \
|
|
.exclude(token_val='0'). \
|
|
values('token_val', 'app_type', 'appBundleId', 'm_code', 'push_type', 'userID_id', 'userID__NickName',
|
|
values('token_val', 'app_type', 'appBundleId', 'm_code', 'push_type', 'userID_id', 'userID__NickName',
|
|
@@ -116,8 +116,10 @@ class DevicePushService:
|
|
'uid_set__channel', 'uid_set__ai_type', 'uid_set__device_type', 'uid_set__new_detect_interval',
|
|
'uid_set__channel', 'uid_set__ai_type', 'uid_set__device_type', 'uid_set__new_detect_interval',
|
|
'uid_set__msg_notify')
|
|
'uid_set__msg_notify')
|
|
else:
|
|
else:
|
|
- # 一键通话只推主用户
|
|
|
|
|
|
+ # 一键通话,视频通话,按下门铃,SD卡异常 只推主用户
|
|
device_info_qs = Device_Info.objects.filter(UID=uid).values('vodPrimaryUserID')
|
|
device_info_qs = Device_Info.objects.filter(UID=uid).values('vodPrimaryUserID')
|
|
|
|
+ if not device_info_qs.exists():
|
|
|
|
+ return None
|
|
primary_user_id = device_info_qs[0]['vodPrimaryUserID']
|
|
primary_user_id = device_info_qs[0]['vodPrimaryUserID']
|
|
if event_type == 607: # 音视频通话根据用户按钮来推送
|
|
if event_type == 607: # 音视频通话根据用户按钮来推送
|
|
button_qs = UserAudioVideoPush.objects.filter(uid=uid).values('buttonUser1', 'buttonUser2')
|
|
button_qs = UserAudioVideoPush.objects.filter(uid=uid).values('buttonUser1', 'buttonUser2')
|
|
@@ -137,6 +139,8 @@ class DevicePushService:
|
|
根据uid获取设备推送(目前仅用在OZI定制客户)
|
|
根据uid获取设备推送(目前仅用在OZI定制客户)
|
|
"""
|
|
"""
|
|
device_info_qs = Device_Info.objects.filter(UID=uid).values('vodPrimaryUserID')
|
|
device_info_qs = Device_Info.objects.filter(UID=uid).values('vodPrimaryUserID')
|
|
|
|
+ if not device_info_qs.exists():
|
|
|
|
+ return None
|
|
primary_user_id = device_info_qs[0]['vodPrimaryUserID']
|
|
primary_user_id = device_info_qs[0]['vodPrimaryUserID']
|
|
uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, userID_id=primary_user_id) \
|
|
uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, userID_id=primary_user_id) \
|
|
.exclude(token_val='0'). \
|
|
.exclude(token_val='0'). \
|
|
@@ -184,10 +188,10 @@ class DevicePushService:
|
|
try:
|
|
try:
|
|
uid = params['uid']
|
|
uid = params['uid']
|
|
params['event_tag'] = cls.get_event_tag(params['ai_type'], params['event_type'], params['detection'])
|
|
params['event_tag'] = cls.get_event_tag(params['ai_type'], params['event_type'], params['detection'])
|
|
- is_app_push = True if params['event_type'] in [606, 607] else \
|
|
|
|
- cls.is_send_app_push(
|
|
|
|
- params['event_type'], params['event_tag'], params['app_push_config'], params['app_push'],
|
|
|
|
- uid, params['channel'])
|
|
|
|
|
|
+ is_app_push = True if params['event_type'] in EventTypeEnumObj.PRIMARY_USERS_PUSH_EVENT_TYPE_LIST.value \
|
|
|
|
+ else cls.is_send_app_push(
|
|
|
|
+ params['event_type'], params['event_tag'], params['app_push_config'], params['app_push'],
|
|
|
|
+ uid, params['channel'])
|
|
|
|
|
|
# 低功耗产品推送,休眠702,低电量704提醒,1023 ozi, 并且detection=0,0标识单事件类型,1标识多事件类型
|
|
# 低功耗产品推送,休眠702,低电量704提醒,1023 ozi, 并且detection=0,0标识单事件类型,1标识多事件类型
|
|
is_app_push = True if params['event_type'] in [702, 704, 1022, 1023] and params[
|
|
is_app_push = True if params['event_type'] in [702, 704, 1022, 1023] and params[
|
|
@@ -208,7 +212,7 @@ class DevicePushService:
|
|
tz = up['tz']
|
|
tz = up['tz']
|
|
if tz is None or tz == '':
|
|
if tz is None or tz == '':
|
|
tz = 0
|
|
tz = 0
|
|
- if params['event_type'] in [606, 607] and push_type in [5, 6]:
|
|
|
|
|
|
+ if params['event_type'] in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value and push_type in [5, 6]:
|
|
process_token = up['jg_token_val']
|
|
process_token = up['jg_token_val']
|
|
push_kwargs['jg_token_val'] = up['jg_token_val']
|
|
push_kwargs['jg_token_val'] = up['jg_token_val']
|
|
else:
|
|
else:
|
|
@@ -288,7 +292,7 @@ class DevicePushService:
|
|
sys_msg_text = cls.get_msg_text(channel=params['channel'], n_time=params['n_time'], lang=lang,
|
|
sys_msg_text = cls.get_msg_text(channel=params['channel'], n_time=params['n_time'], lang=lang,
|
|
tz=tz, is_sys=1, device_type=params['device_type'],
|
|
tz=tz, is_sys=1, device_type=params['device_type'],
|
|
event_type=params['event_type'],
|
|
event_type=params['event_type'],
|
|
- electricity=params['electricity'])
|
|
|
|
|
|
+ electricity=params['electricity'], is_save_msg=1)
|
|
sys_msg_list.append(SysMsgModel(userID_id=user_id, msg=sys_msg_text, addTime=now_time,
|
|
sys_msg_list.append(SysMsgModel(userID_id=user_id, msg=sys_msg_text, addTime=now_time,
|
|
updTime=now_time, uid=uid, eventType=params['event_type']))
|
|
updTime=now_time, uid=uid, eventType=params['event_type']))
|
|
# 保存推送消息
|
|
# 保存推送消息
|
|
@@ -304,7 +308,7 @@ class DevicePushService:
|
|
'device_uid': params['uid'],
|
|
'device_uid': params['uid'],
|
|
'device_nick_name': params['nickname'],
|
|
'device_nick_name': params['nickname'],
|
|
'channel': params['channel'],
|
|
'channel': params['channel'],
|
|
- 'alarm': 'Motion \tChannel:{}'.format(params['channel']),
|
|
|
|
|
|
+ 'alarm': '',
|
|
'is_st': params['is_st'],
|
|
'is_st': params['is_st'],
|
|
'add_time': int(time.time()),
|
|
'add_time': int(time.time()),
|
|
'storage_location': params['storage_location'],
|
|
'storage_location': params['storage_location'],
|
|
@@ -325,7 +329,8 @@ class DevicePushService:
|
|
|
|
|
|
# 一键通话和视频通话需要实时写入数据
|
|
# 一键通话和视频通话需要实时写入数据
|
|
# 正式服通过定时任务批量写入数据
|
|
# 正式服通过定时任务批量写入数据
|
|
- if params['event_type'] in [606, 607] or CONFIG_INFO == CONFIG_TEST:
|
|
|
|
|
|
+ if params['event_type'] in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value or \
|
|
|
|
+ CONFIG_INFO == CONFIG_TEST:
|
|
end = 0
|
|
end = 0
|
|
# 缓存数据多于100条,批量保存前100条,否则保存全部
|
|
# 缓存数据多于100条,批量保存前100条,否则保存全部
|
|
equipment_info_len = redis_obj.llen(equipment_info_key)
|
|
equipment_info_len = redis_obj.llen(equipment_info_key)
|
|
@@ -429,8 +434,7 @@ class DevicePushService:
|
|
# thread_pool.submit(cls.async_send_picture_push, (
|
|
# thread_pool.submit(cls.async_send_picture_push, (
|
|
# push_type, kwargs['aws_s3_client'], kwargs['bucket'], key,
|
|
# push_type, kwargs['aws_s3_client'], kwargs['bucket'], key,
|
|
# kwargs['uid'], kwargs['appBundleId'], kwargs['token_val'], kwargs['event_type'], kwargs['n_time'],
|
|
# kwargs['uid'], kwargs['appBundleId'], kwargs['token_val'], kwargs['event_type'], kwargs['n_time'],
|
|
- # push_kwargs['msg_title'], push_kwargs['msg_text'], kwargs['channel'], kwargs['storage_location']))
|
|
|
|
-
|
|
|
|
|
|
+ # push_kwargs['msg_title'], push_kwargs['msg_text'], kwargs['channel'], kwargs['storage_location'])
|
|
push_thread = threading.Thread(target=cls.async_send_picture_push, args=(
|
|
push_thread = threading.Thread(target=cls.async_send_picture_push, args=(
|
|
push_type, kwargs['aws_s3_client'], kwargs['bucket'], key,
|
|
push_type, kwargs['aws_s3_client'], kwargs['bucket'], key,
|
|
kwargs['uid'], kwargs['appBundleId'], kwargs['token_val'], kwargs['event_type'], kwargs['n_time'],
|
|
kwargs['uid'], kwargs['appBundleId'], kwargs['token_val'], kwargs['event_type'], kwargs['n_time'],
|
|
@@ -490,7 +494,7 @@ class DevicePushService:
|
|
elif push_type == 8: # android honorpush
|
|
elif push_type == 8: # android honorpush
|
|
push_result = PushObject.android_honorpush(**push_kwargs)
|
|
push_result = PushObject.android_honorpush(**push_kwargs)
|
|
|
|
|
|
- if kwargs['event_type'] in [606, 607]:
|
|
|
|
|
|
+ if kwargs['event_type'] in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
close_old_connections()
|
|
close_old_connections()
|
|
# 写入日志表
|
|
# 写入日志表
|
|
PushLog.objects.create(uid=uid, event_type=kwargs['event_type'], created_time=int(time.time()),
|
|
PushLog.objects.create(uid=uid, event_type=kwargs['event_type'], created_time=int(time.time()),
|
|
@@ -534,7 +538,7 @@ class DevicePushService:
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def get_msg_text(channel, n_time, lang, tz, event_type, electricity='', is_sys=0, dealings_type=0, ai_type=0,
|
|
def get_msg_text(channel, n_time, lang, tz, event_type, electricity='', is_sys=0, dealings_type=0, ai_type=0,
|
|
- device_type=0, event_tag=''):
|
|
|
|
|
|
+ device_type=0, event_tag='', is_save_msg=0):
|
|
"""
|
|
"""
|
|
获取消息文本
|
|
获取消息文本
|
|
@param: channel 通道号
|
|
@param: channel 通道号
|
|
@@ -548,18 +552,20 @@ class DevicePushService:
|
|
@param: ai_type 设备本地AI只能算法 事件类型
|
|
@param: ai_type 设备本地AI只能算法 事件类型
|
|
@param: device_type 设备类型
|
|
@param: device_type 设备类型
|
|
@param: event_tag 设备算法事件标签
|
|
@param: event_tag 设备算法事件标签
|
|
|
|
+ @parm: is_save_msg 保存消息
|
|
"""
|
|
"""
|
|
msg_type = ''
|
|
msg_type = ''
|
|
event_type = int(event_type)
|
|
event_type = int(event_type)
|
|
device_type = int(device_type)
|
|
device_type = int(device_type)
|
|
event_list = []
|
|
event_list = []
|
|
if event_tag:
|
|
if event_tag:
|
|
|
|
+ # 移除非组合推送类型
|
|
event_list = [int(event) for event in event_tag.split(',') if event]
|
|
event_list = [int(event) for event in event_tag.split(',') if event]
|
|
-
|
|
|
|
- events_to_remove = [702, 703, 704]
|
|
|
|
|
|
+ events_to_remove = SYS_EVENT_TYPE_LIST
|
|
for event in events_to_remove:
|
|
for event in events_to_remove:
|
|
if event in event_list:
|
|
if event in event_list:
|
|
event_list.remove(event)
|
|
event_list.remove(event)
|
|
|
|
+
|
|
if lang == 'cn':
|
|
if lang == 'cn':
|
|
if event_type == 51:
|
|
if event_type == 51:
|
|
msg_type = '检测到画面变化'
|
|
msg_type = '检测到画面变化'
|
|
@@ -591,20 +597,26 @@ class DevicePushService:
|
|
msg_type = '有人徘徊'
|
|
msg_type = '有人徘徊'
|
|
elif event_type == 65:
|
|
elif event_type == 65:
|
|
msg_type = '长时间无人出现'
|
|
msg_type = '长时间无人出现'
|
|
|
|
+
|
|
elif event_type == 1022:
|
|
elif event_type == 1022:
|
|
msg_type = '有人按下门铃'
|
|
msg_type = '有人按下门铃'
|
|
elif event_type == 1023:
|
|
elif event_type == 1023:
|
|
msg_type = '儿童保护模式开启'
|
|
msg_type = '儿童保护模式开启'
|
|
|
|
|
|
- elif event_type == 704:
|
|
|
|
- msg_type = '电量低'
|
|
|
|
elif event_type == 702:
|
|
elif event_type == 702:
|
|
msg_type = '摄像头休眠'
|
|
msg_type = '摄像头休眠'
|
|
elif event_type == 703:
|
|
elif event_type == 703:
|
|
msg_type = '摄像头唤醒'
|
|
msg_type = '摄像头唤醒'
|
|
- elif event_type in [606, 607]:
|
|
|
|
|
|
+ elif event_type == 704:
|
|
|
|
+ msg_type = '电量低'
|
|
|
|
+ elif event_type == 706:
|
|
|
|
+ msg_type = 'SD卡异常,请重新插拔或格式化SD卡。'
|
|
|
|
+ if is_save_msg:
|
|
|
|
+ msg_type = 'SD卡异常,请重新插拔或格式化SD卡。如问题仍未解决,请联系在线客服。'
|
|
|
|
+
|
|
|
|
+ elif event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
msg_type = '有人呼叫,请点击查看'
|
|
msg_type = '有人呼叫,请点击查看'
|
|
- if event_type not in [606, 607, 1022] and ai_type > 0 and event_list:
|
|
|
|
|
|
+ if event_type not in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value and ai_type > 0 and event_list:
|
|
msg_type = ''.join([DevicePushService.get_event_type_text(lang, item, dealings_type)
|
|
msg_type = ''.join([DevicePushService.get_event_type_text(lang, item, dealings_type)
|
|
for item in event_list])
|
|
for item in event_list])
|
|
if is_sys:
|
|
if is_sys:
|
|
@@ -648,20 +660,27 @@ class DevicePushService:
|
|
msg_type = 'Loitering detected'
|
|
msg_type = 'Loitering detected'
|
|
elif event_type == 65:
|
|
elif event_type == 65:
|
|
msg_type = 'No appearance for a long time'
|
|
msg_type = 'No appearance for a long time'
|
|
|
|
+
|
|
elif event_type == 1022:
|
|
elif event_type == 1022:
|
|
msg_type = 'Someone rang the doorbell'
|
|
msg_type = 'Someone rang the doorbell'
|
|
elif event_type == 1023:
|
|
elif event_type == 1023:
|
|
msg_type = 'Child protection mode is enabled'
|
|
msg_type = 'Child protection mode is enabled'
|
|
|
|
|
|
- elif event_type == 704:
|
|
|
|
- msg_type = 'low battery'
|
|
|
|
elif event_type == 702:
|
|
elif event_type == 702:
|
|
msg_type = 'Camera sleep'
|
|
msg_type = 'Camera sleep'
|
|
elif event_type == 703:
|
|
elif event_type == 703:
|
|
msg_type = 'Camera wake'
|
|
msg_type = 'Camera wake'
|
|
- elif event_type in [606, 607]:
|
|
|
|
|
|
+ elif event_type == 704:
|
|
|
|
+ msg_type = 'low battery'
|
|
|
|
+ elif event_type == 706:
|
|
|
|
+ msg_type = 'SD card is abnormal. Please re-insert or format the SD card.'
|
|
|
|
+ if is_save_msg:
|
|
|
|
+ msg_type = 'SD card is abnormal, please re-insert or format the SD card. ' \
|
|
|
|
+ 'If the problem is still not solved, please contact online customer service.'
|
|
|
|
+
|
|
|
|
+ elif event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
msg_type = 'Someone is calling, please click to view'
|
|
msg_type = 'Someone is calling, please click to view'
|
|
- if event_type not in [606, 607, 1022] and ai_type > 0 and event_list:
|
|
|
|
|
|
+ elif event_type not in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value and ai_type > 0 and event_list:
|
|
msg_type = ''.join([DevicePushService.get_event_type_text(lang, item, dealings_type)
|
|
msg_type = ''.join([DevicePushService.get_event_type_text(lang, item, dealings_type)
|
|
for item in event_list])
|
|
for item in event_list])
|
|
if is_sys:
|
|
if is_sys:
|
|
@@ -697,7 +716,7 @@ class DevicePushService:
|
|
event_list.remove(event)
|
|
event_list.remove(event)
|
|
|
|
|
|
# 简体中文、英文、西班牙语、法语、德语、繁体中文、葡萄牙语、俄语、日语、意大利语、波兰语、韩语、阿拉伯语
|
|
# 简体中文、英文、西班牙语、法语、德语、繁体中文、葡萄牙语、俄语、日语、意大利语、波兰语、韩语、阿拉伯语
|
|
- SUPPORTED_LANGS = {'cn', 'en', 'es', 'fr', 'de', 'cn_tw', 'pt', 'ru', 'ja', 'it', 'pl', 'nl', 'ko', 'ar'}
|
|
|
|
|
|
+ SUPPORTED_LANGS = {'cn', 'en', 'es', 'fr', 'de', 'cn_tw', 'pt', 'ru', 'ja', 'it', 'pl', 'nl', 'kr', 'ar'}
|
|
MIN_EVENT_TYPE, MAX_EVENT_TYPE = 51, 65
|
|
MIN_EVENT_TYPE, MAX_EVENT_TYPE = 51, 65
|
|
# 根据语言获取对应单个事件文案
|
|
# 根据语言获取对应单个事件文案
|
|
if lang in SUPPORTED_LANGS and MIN_EVENT_TYPE <= event_type <= MAX_EVENT_TYPE:
|
|
if lang in SUPPORTED_LANGS and MIN_EVENT_TYPE <= event_type <= MAX_EVENT_TYPE:
|
|
@@ -714,11 +733,11 @@ class DevicePushService:
|
|
msg_type = MSG_CONFIG[703].get(lang, '')
|
|
msg_type = MSG_CONFIG[703].get(lang, '')
|
|
elif event_type == 704:
|
|
elif event_type == 704:
|
|
msg_type = MSG_CONFIG[704].get(lang, '')
|
|
msg_type = MSG_CONFIG[704].get(lang, '')
|
|
- elif event_type == 705:
|
|
|
|
|
|
+ elif event_type == 706:
|
|
if is_save_msg:
|
|
if is_save_msg:
|
|
- msg_type = MSG_CONFIG[705]['save'].get(lang, '')
|
|
|
|
|
|
+ msg_type = MSG_CONFIG[706]['save'].get(lang, '')
|
|
else:
|
|
else:
|
|
- msg_type = MSG_CONFIG[705]['default'].get(lang, '')
|
|
|
|
|
|
+ msg_type = MSG_CONFIG[706]['default'].get(lang, '')
|
|
|
|
|
|
elif event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
elif event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
msg_type = MSG_CONFIG['data_push'].get(lang, '')
|
|
msg_type = MSG_CONFIG['data_push'].get(lang, '')
|
|
@@ -771,10 +790,8 @@ class DevicePushService:
|
|
try:
|
|
try:
|
|
url = 'https://api.xmpush.xiaomi.com/v3/message/regid'
|
|
url = 'https://api.xmpush.xiaomi.com/v3/message/regid'
|
|
app_secret = XMPUSH_CONFIG[appBundleId]
|
|
app_secret = XMPUSH_CONFIG[appBundleId]
|
|
- # payload = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
|
- # 'received_at': n_time, 'event_time': n_time, 'event_type': event_type,
|
|
|
|
- # 'uid': uid, 'channel': channel
|
|
|
|
- # }
|
|
|
|
|
|
+ # 跳转类型
|
|
|
|
+ jump_type = CommonService.get_jump_type(event_type)
|
|
data = {
|
|
data = {
|
|
'title': msg_title,
|
|
'title': msg_title,
|
|
'description': msg_text,
|
|
'description': msg_text,
|
|
@@ -782,7 +799,7 @@ class DevicePushService:
|
|
'restricted_package_name': appBundleId,
|
|
'restricted_package_name': appBundleId,
|
|
'registration_id': token_val,
|
|
'registration_id': token_val,
|
|
'extra.channel_id': channel_id,
|
|
'extra.channel_id': channel_id,
|
|
- 'extra.alert': 'Motion',
|
|
|
|
|
|
+ 'extra.alert': msg_text,
|
|
'extra.msg': '',
|
|
'extra.msg': '',
|
|
'extra.sound': 'sound.aif',
|
|
'extra.sound': 'sound.aif',
|
|
'extra.zpush': '1',
|
|
'extra.zpush': '1',
|
|
@@ -791,8 +808,9 @@ class DevicePushService:
|
|
'extra.event_type': event_type,
|
|
'extra.event_type': event_type,
|
|
'extra.uid': uid,
|
|
'extra.uid': uid,
|
|
'extra.channel': channel,
|
|
'extra.channel': channel,
|
|
|
|
+ 'extra.jump_type': jump_type
|
|
}
|
|
}
|
|
- if event_type in [606, 607]:
|
|
|
|
|
|
+ if event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
data['extra.sound_uri'] = 'android.resource://com.ansjer.zccloud_ab/raw/phone_call'
|
|
data['extra.sound_uri'] = 'android.resource://com.ansjer.zccloud_ab/raw/phone_call'
|
|
headers = {
|
|
headers = {
|
|
'Authorization': 'key={}'.format(app_secret)
|
|
'Authorization': 'key={}'.format(app_secret)
|
|
@@ -817,7 +835,7 @@ class DevicePushService:
|
|
android 国内oppo APP消息提醒推送
|
|
android 国内oppo APP消息提醒推送
|
|
"""
|
|
"""
|
|
try:
|
|
try:
|
|
- if event_type in [606, 607]:
|
|
|
|
|
|
+ if event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
channel_id = XM_PUSH_CHANNEL_ID['push_to_talk']
|
|
channel_id = XM_PUSH_CHANNEL_ID['push_to_talk']
|
|
app_key = OPPOPUSH_CONFIG[appBundleId]['Key']
|
|
app_key = OPPOPUSH_CONFIG[appBundleId]['Key']
|
|
master_secret = OPPOPUSH_CONFIG[appBundleId]['Secret']
|
|
master_secret = OPPOPUSH_CONFIG[appBundleId]['Secret']
|
|
@@ -841,9 +859,11 @@ class DevicePushService:
|
|
result = response.json()
|
|
result = response.json()
|
|
# 发送推送
|
|
# 发送推送
|
|
push_url = url + 'server/v1/message/notification/unicast'
|
|
push_url = url + 'server/v1/message/notification/unicast'
|
|
- extra_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
|
|
|
+ # 跳转类型
|
|
|
|
+ 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,
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type,
|
|
- 'uid': uid, 'channel': channel}
|
|
|
|
|
|
+ 'uid': uid, 'channel': channel, 'jump_type': jump_type}
|
|
message = {
|
|
message = {
|
|
"target_type": 2,
|
|
"target_type": 2,
|
|
"target_value": token_val,
|
|
"target_value": token_val,
|
|
@@ -863,7 +883,7 @@ class DevicePushService:
|
|
|
|
|
|
response = requests.post(push_url, data=push_data, headers=headers)
|
|
response = requests.post(push_url, data=push_data, headers=headers)
|
|
if response.status_code == 200:
|
|
if response.status_code == 200:
|
|
- if event_type in [606, 607]:
|
|
|
|
|
|
+ if event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
PushObject.jpush_transparent_transmission(msg_title, msg_text, appBundleId, jg_token_val,
|
|
PushObject.jpush_transparent_transmission(msg_title, msg_text, appBundleId, jg_token_val,
|
|
extra_data)
|
|
extra_data)
|
|
return True
|
|
return True
|