|
@@ -13,6 +13,8 @@ from Object.utils import LocalDateTimeUtil
|
|
|
from Service.DevicePushService import DevicePushService
|
|
|
from Service.EquipmentInfoService import EquipmentInfoService
|
|
|
|
|
|
+logger = logging.getLogger('v1_push')
|
|
|
+
|
|
|
|
|
|
# 旧移动侦测接口
|
|
|
class NotificationView(View):
|
|
@@ -35,7 +37,6 @@ class NotificationView(View):
|
|
|
@param request_dict:event_type 设备事件类型
|
|
|
@param request_dict:is_st 文件类型(0:无,1:图片,2:视频)
|
|
|
"""
|
|
|
- logger = logging.getLogger('info')
|
|
|
uidToken = request_dict.get('uidToken', None)
|
|
|
etk = request_dict.get('etk', None)
|
|
|
channel = request_dict.get('channel', '1')
|
|
@@ -49,7 +50,7 @@ class NotificationView(View):
|
|
|
uid = DevicePushService.decode_uid(etk, uidToken) # 解密uid
|
|
|
if len(uid) != 20 and len(uid) != 14:
|
|
|
return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
|
|
|
- logger.info("旧移动侦测接口的uid:{}".format(uid))
|
|
|
+ logger.info("旧移动侦测接口的uid:{},时间戳:{},事件类型:{}".format(uid, n_time, event_type))
|
|
|
event_type = int(event_type)
|
|
|
pkey = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, event_type=event_type, channel=channel)
|
|
|
ykey = '{uid}_redis_qs'.format(uid=uid)
|
|
@@ -177,6 +178,7 @@ class NotificationView(View):
|
|
|
del up['uid_set__detect_interval']
|
|
|
del up['uid_set__detect_group']
|
|
|
res_data = {'code': 0, 'img_push': url, 'msg': 'success'}
|
|
|
+ logger.info('推送响应,uid:{},n_time:{},事件类型:{},响应:{}'.format(uid, n_time, event_type, json.dumps(res_data)))
|
|
|
return JsonResponse(status=200, data=res_data)
|
|
|
|
|
|
elif is_st == '3':
|
|
@@ -205,6 +207,7 @@ class NotificationView(View):
|
|
|
del up['uid_set__detect_group']
|
|
|
|
|
|
res_data = {'code': 0, 'img_url_list': img_url_list, 'msg': 'success 3'}
|
|
|
+ logger.info('推送响应,uid:{},n_time:{},事件类型:{},响应:{}'.format(uid, n_time, event_type, json.dumps(res_data)))
|
|
|
return JsonResponse(status=200, data=res_data)
|
|
|
except Exception as e:
|
|
|
logger.info('旧推送接口异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|