|
@@ -107,7 +107,7 @@ class DevicePushService:
|
|
|
@param button: 按钮
|
|
|
@return: uid_push_qs
|
|
|
"""
|
|
|
- if event_type not in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
|
+ 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) \
|
|
|
.exclude(token_val='0'). \
|
|
|
values('token_val', 'app_type', 'appBundleId', 'm_code', 'push_type', 'userID_id', 'userID__NickName',
|
|
@@ -115,7 +115,7 @@ class DevicePushService:
|
|
|
'uid_set__channel', 'uid_set__ai_type', 'uid_set__device_type', 'uid_set__new_detect_interval',
|
|
|
'uid_set__msg_notify')
|
|
|
else:
|
|
|
- # 一键通话,按下门铃只推主用户
|
|
|
+ # 一键通话,视频通话,按下门铃,SD卡异常 只推主用户
|
|
|
device_info_qs = Device_Info.objects.filter(UID=uid).values('vodPrimaryUserID')
|
|
|
primary_user_id = device_info_qs[0]['vodPrimaryUserID']
|
|
|
if event_type == 607: # 音视频通话根据用户按钮来推送
|
|
@@ -183,10 +183,10 @@ class DevicePushService:
|
|
|
try:
|
|
|
uid = params['uid']
|
|
|
params['event_tag'] = cls.get_event_tag(params['ai_type'], params['event_type'], params['detection'])
|
|
|
- is_app_push = True if params['event_type'] in EventTypeEnumObj.DATA_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'])
|
|
|
+ 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标识多事件类型
|
|
|
is_app_push = True if params['event_type'] in [702, 704, 1022, 1023] and params[
|
|
@@ -287,7 +287,7 @@ class DevicePushService:
|
|
|
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'],
|
|
|
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,
|
|
|
updTime=now_time, uid=uid, eventType=params['event_type']))
|
|
|
# 保存推送消息
|
|
@@ -535,7 +535,7 @@ class DevicePushService:
|
|
|
|
|
|
@staticmethod
|
|
|
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 通道号
|
|
@@ -549,18 +549,20 @@ class DevicePushService:
|
|
|
@param: ai_type 设备本地AI只能算法 事件类型
|
|
|
@param: device_type 设备类型
|
|
|
@param: event_tag 设备算法事件标签
|
|
|
+ @parm: is_save_msg 保存消息
|
|
|
"""
|
|
|
msg_type = ''
|
|
|
event_type = int(event_type)
|
|
|
device_type = int(device_type)
|
|
|
event_list = []
|
|
|
if event_tag:
|
|
|
+ # 移除非组合推送类型
|
|
|
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:
|
|
|
if event in event_list:
|
|
|
event_list.remove(event)
|
|
|
+
|
|
|
if lang == 'cn':
|
|
|
if event_type == 51:
|
|
|
msg_type = '检测到画面变化'
|
|
@@ -598,15 +600,20 @@ class DevicePushService:
|
|
|
elif event_type == 1023:
|
|
|
msg_type = '儿童保护模式开启'
|
|
|
|
|
|
- elif event_type == 704:
|
|
|
- msg_type = '电量低'
|
|
|
elif event_type == 702:
|
|
|
msg_type = '摄像头休眠'
|
|
|
elif event_type == 703:
|
|
|
msg_type = '摄像头唤醒'
|
|
|
- elif event_type in [606, 607]:
|
|
|
+ elif event_type == 704:
|
|
|
+ msg_type = '电量低'
|
|
|
+ elif event_type == 705:
|
|
|
+ msg_type = '录像异常,请重新插拔或格式化 SD 卡。'
|
|
|
+ if is_save_msg:
|
|
|
+ msg_type = '录像异常,请重新插拔或格式化 SD 卡。如问题仍未解决,请联系在线客服。'
|
|
|
+
|
|
|
+ elif event_type in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
|
msg_type = '有人呼叫,请点击查看'
|
|
|
- if event_type not in [606, 607] 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)
|
|
|
for item in event_list])
|
|
|
if is_sys:
|
|
@@ -656,12 +663,18 @@ class DevicePushService:
|
|
|
elif event_type == 1023:
|
|
|
msg_type = 'Child protection mode is enabled'
|
|
|
|
|
|
- elif event_type == 704:
|
|
|
- msg_type = 'low battery'
|
|
|
elif event_type == 702:
|
|
|
msg_type = 'Camera sleep'
|
|
|
elif event_type == 703:
|
|
|
msg_type = 'Camera wake'
|
|
|
+ elif event_type == 704:
|
|
|
+ msg_type = 'low battery'
|
|
|
+ elif event_type == 705:
|
|
|
+ msg_type = 'Abnormal recording, please re-insert or format the SD card.'
|
|
|
+ if is_save_msg:
|
|
|
+ msg_type = 'Abnormal recording, 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'
|
|
|
elif event_type not in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value and ai_type > 0 and event_list:
|