|
@@ -29,6 +29,7 @@ from Model.models import UidPushModel, SysMsgModel, DeviceSharePermission, Devic
|
|
|
from Object.ETkObject import ETkObject
|
|
|
from Object.OCIObjectStorage import OCIObjectStorage
|
|
|
from Object.UidTokenObject import UidTokenObject
|
|
|
+from Object.enums.EventTypeEnum import EventTypeEnumObj
|
|
|
from Object.utils import LocalDateTimeUtil
|
|
|
from Service.CommonService import CommonService
|
|
|
from Service.EquipmentInfoService import EquipmentInfoService, EQUIPMENT_INFO_DICT
|
|
@@ -103,7 +104,7 @@ class DevicePushService:
|
|
|
@param button: 按钮
|
|
|
@return: uid_push_qs
|
|
|
"""
|
|
|
- if event_type not in [606, 607]:
|
|
|
+ if event_type not in EventTypeEnumObj.DATA_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',
|
|
@@ -111,7 +112,7 @@ class DevicePushService:
|
|
|
'uid_set__channel', 'uid_set__ai_type', 'uid_set__device_type', 'uid_set__new_detect_interval',
|
|
|
'uid_set__msg_notify')
|
|
|
else:
|
|
|
- # 一键通话只推主用户
|
|
|
+ # 一键通话,按下门铃只推主用户
|
|
|
device_info_qs = Device_Info.objects.filter(UID=uid).values('vodPrimaryUserID')
|
|
|
primary_user_id = device_info_qs[0]['vodPrimaryUserID']
|
|
|
if event_type == 607: # 音视频通话根据用户按钮来推送
|
|
@@ -179,7 +180,7 @@ 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 [606, 607] else \
|
|
|
+ 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'])
|
|
@@ -202,7 +203,7 @@ class DevicePushService:
|
|
|
tz = up['tz']
|
|
|
if tz is None or tz == '':
|
|
|
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]:
|
|
|
push_kwargs['jg_token_val'] = up['jg_token_val']
|
|
|
else:
|
|
|
if 'jg_token_val' in push_kwargs:
|
|
@@ -313,7 +314,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
|
|
|
# 缓存数据多于100条,批量保存前100条,否则保存全部
|
|
|
equipment_info_len = redis_obj.llen(equipment_info_key)
|
|
@@ -462,7 +464,7 @@ class DevicePushService:
|
|
|
huawei_push_object = HuaweiPushObject()
|
|
|
huawei_push_object.send_push_notify_message(**push_kwargs)
|
|
|
elif push_type == 4: # android xmpush
|
|
|
- if kwargs['event_type'] in [606, 607]:
|
|
|
+ if kwargs['event_type'] in EventTypeEnumObj.DATA_PUSH_EVENT_TYPE_LIST.value:
|
|
|
push_channel = 'push_to_talk'
|
|
|
else:
|
|
|
push_channel = 'device_reminder'
|
|
@@ -478,7 +480,7 @@ class DevicePushService:
|
|
|
elif push_type == 8: # android honorpush
|
|
|
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()
|
|
|
# 写入日志表
|
|
|
PushLog.objects.create(uid=uid, event_type=kwargs['event_type'], created_time=int(time.time()),
|
|
@@ -647,9 +649,9 @@ class DevicePushService:
|
|
|
msg_type = 'Camera sleep'
|
|
|
elif event_type == 703:
|
|
|
msg_type = 'Camera wake'
|
|
|
- elif event_type in [606, 607]:
|
|
|
+ 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 [606, 607] 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)
|
|
|
for item in event_list])
|
|
|
if is_sys:
|
|
@@ -694,7 +696,7 @@ class DevicePushService:
|
|
|
'extra.uid': uid,
|
|
|
'extra.channel': channel,
|
|
|
}
|
|
|
- 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'
|
|
|
headers = {
|
|
|
'Authorization': 'key={}'.format(app_secret)
|
|
@@ -718,7 +720,7 @@ class DevicePushService:
|
|
|
android 国内oppo APP消息提醒推送
|
|
|
"""
|
|
|
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']
|
|
|
app_key = OPPOPUSH_CONFIG[appBundleId]['Key']
|
|
|
master_secret = OPPOPUSH_CONFIG[appBundleId]['Secret']
|
|
@@ -766,7 +768,7 @@ class DevicePushService:
|
|
|
if response.status_code == 200:
|
|
|
LOGGING.info(
|
|
|
"oppo推送返回值:{},uid:{},time:{},event:{}".format(response.json(), uid, now_time, event_type))
|
|
|
- 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,
|
|
|
extra_data)
|
|
|
return True
|