|
@@ -36,7 +36,6 @@ from Service.HuaweiPushService.HuaweiPushService import HuaweiPushObject
|
|
|
from Service.PushService import PushObject
|
|
|
from django.db import close_old_connections
|
|
|
|
|
|
-
|
|
|
LOGGING = logging.getLogger('info')
|
|
|
TIME_LOGGER = logging.getLogger('time')
|
|
|
ERROR_INFO_LOGGER = logging.getLogger('error_info')
|
|
@@ -186,7 +185,8 @@ class DevicePushService:
|
|
|
uid, params['channel'])
|
|
|
|
|
|
# 低功耗产品推送,休眠702,低电量704提醒,1023 ozi, 并且detection=0,0标识单事件类型,1标识多事件类型
|
|
|
- is_app_push = True if params['event_type'] in [702, 704, 1023] and params['detection'] == 0 else is_app_push
|
|
|
+ is_app_push = True if params['event_type'] in [702, 704, 1022, 1023] and params[
|
|
|
+ 'detection'] == 0 else is_app_push
|
|
|
redis_obj = params['redis_obj']
|
|
|
# 推送
|
|
|
if is_app_push:
|
|
@@ -321,8 +321,9 @@ class DevicePushService:
|
|
|
if CONFIG_INFO == CONFIG_TEST:
|
|
|
end = equipment_info_len
|
|
|
LOGGING.info(
|
|
|
- 'uid:{},time:{},存表:{},条数:{}, 事件类型:{}'.format(uid, params['n_time'], equipment_info_key, end,
|
|
|
- params['event_type']))
|
|
|
+ 'uid:{},time:{},存表:{},条数:{}, 事件类型:{}'.format(uid, params['n_time'], equipment_info_key,
|
|
|
+ end,
|
|
|
+ params['event_type']))
|
|
|
|
|
|
if end != 0:
|
|
|
equipment_info_redis_list = redis_obj.lrange(equipment_info_key, 0, end)
|
|
@@ -578,6 +579,8 @@ class DevicePushService:
|
|
|
msg_type = '有人徘徊'
|
|
|
elif event_type == 65:
|
|
|
msg_type = '长时间无人出现'
|
|
|
+ elif event_type == 1022:
|
|
|
+ msg_type = '有人按下门铃'
|
|
|
elif event_type == 1023:
|
|
|
msg_type = '儿童保护模式开启'
|
|
|
|
|
@@ -633,6 +636,8 @@ class DevicePushService:
|
|
|
msg_type = 'Loitering detected'
|
|
|
elif event_type == 65:
|
|
|
msg_type = 'No appearance for a long time'
|
|
|
+ elif event_type == 1022:
|
|
|
+ msg_type = 'Someone rang the doorbell'
|
|
|
elif event_type == 1023:
|
|
|
msg_type = 'Child protection mode is enabled'
|
|
|
|
|
@@ -759,9 +764,11 @@ class DevicePushService:
|
|
|
|
|
|
response = requests.post(push_url, data=push_data, headers=headers)
|
|
|
if response.status_code == 200:
|
|
|
- LOGGING.info("oppo推送返回值:{},uid:{},time:{},event:{}".format(response.json(), uid, now_time, event_type))
|
|
|
+ LOGGING.info(
|
|
|
+ "oppo推送返回值:{},uid:{},time:{},event:{}".format(response.json(), uid, now_time, event_type))
|
|
|
if event_type in [606, 607]:
|
|
|
- PushObject.jpush_transparent_transmission(msg_title, msg_text, appBundleId, jg_token_val, extra_data)
|
|
|
+ PushObject.jpush_transparent_transmission(msg_title, msg_text, appBundleId, jg_token_val,
|
|
|
+ extra_data)
|
|
|
return True
|
|
|
return False
|
|
|
except Exception as e:
|
|
@@ -803,7 +810,8 @@ class DevicePushService:
|
|
|
|
|
|
TIME_LOGGER.info('{}推送图片,push_type:{},推送结果:{}'.format(uid, push_type, push_result))
|
|
|
except Exception as e:
|
|
|
- ERROR_INFO_LOGGER.error('异步推送图片异常,error_line:{},error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+ ERROR_INFO_LOGGER.error(
|
|
|
+ '异步推送图片异常,error_line:{},error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|
|
|
@staticmethod
|
|
|
def oci_object_url(uid, redis_obj, storage_location, bucket, obj_name):
|
|
@@ -1021,7 +1029,8 @@ class DevicePushService:
|
|
|
LOGGING.info('{}APP推送消息类型提醒是否执行:{}'.format(uid, push_result))
|
|
|
return push_result
|
|
|
except Exception as e:
|
|
|
- LOGGING.info('{}判断是否执行APP推送异常,errLine:{}, errMsg:{}'.format(uid, e.__traceback__.tb_lineno, repr(e)))
|
|
|
+ LOGGING.info(
|
|
|
+ '{}判断是否执行APP推送异常,errLine:{}, errMsg:{}'.format(uid, e.__traceback__.tb_lineno, repr(e)))
|
|
|
return True
|
|
|
|
|
|
@staticmethod
|
|
@@ -1050,7 +1059,8 @@ class DevicePushService:
|
|
|
|
|
|
except Exception as e:
|
|
|
# 记录异常信息并返回 False
|
|
|
- ERROR_INFO_LOGGER.error('NVRAPP推送异常, errLine: {}, errMsg: {}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+ ERROR_INFO_LOGGER.error(
|
|
|
+ 'NVRAPP推送异常, errLine: {}, errMsg: {}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
return False
|
|
|
|
|
|
@staticmethod
|