|
@@ -637,7 +637,8 @@ def uid_status(request):
|
|
response.lang = tko.lang
|
|
response.lang = tko.lang
|
|
if tko.code != 0:
|
|
if tko.code != 0:
|
|
return response.json(tko.code)
|
|
return response.json(tko.code)
|
|
- qs = UidSetModel.objects.filter(uid=uid).values('uid', 'detect_status', 'detect_interval', 'version', 'ucode','p2p_region')
|
|
|
|
|
|
+ qs = UidSetModel.objects.filter(uid=uid).values('uid', 'detect_status', 'detect_interval', 'version', 'ucode',
|
|
|
|
+ 'p2p_region')
|
|
# 判断uid配置表信息是否存在
|
|
# 判断uid配置表信息是否存在
|
|
if qs.exists():
|
|
if qs.exists():
|
|
data = {
|
|
data = {
|
|
@@ -645,7 +646,7 @@ def uid_status(request):
|
|
'push_interval': qs[0]['detect_interval'], # 推送间隔
|
|
'push_interval': qs[0]['detect_interval'], # 推送间隔
|
|
'ucode': qs[0]['ucode'],
|
|
'ucode': qs[0]['ucode'],
|
|
'version': qs[0]['version'],
|
|
'version': qs[0]['version'],
|
|
- 'p2p_region':qs[0]['p2p_region']
|
|
|
|
|
|
+ 'p2p_region': qs[0]['p2p_region']
|
|
}
|
|
}
|
|
# 查询云存储相关信息
|
|
# 查询云存储相关信息
|
|
ubqs = UID_Bucket.objects.filter(uid=uid). \
|
|
ubqs = UID_Bucket.objects.filter(uid=uid). \
|
|
@@ -720,17 +721,27 @@ def update_device_shadow(request):
|
|
ucode = request_dict.get('ucode', None)
|
|
ucode = request_dict.get('ucode', None)
|
|
version = request_dict.get('version', None)
|
|
version = request_dict.get('version', None)
|
|
p2p_region = request_dict.get('p2p_region', None)
|
|
p2p_region = request_dict.get('p2p_region', None)
|
|
|
|
+ tz = request_dict.get('tz', None)
|
|
|
|
+ video_code = request_dict.get('video_code', None)
|
|
|
|
+ ip = CommonService.get_ip_address(request)
|
|
us_qs = UidSetModel.objects.filter(uid=uid)
|
|
us_qs = UidSetModel.objects.filter(uid=uid)
|
|
# 更新
|
|
# 更新
|
|
nowTime = int(time.time())
|
|
nowTime = int(time.time())
|
|
if us_qs.exists():
|
|
if us_qs.exists():
|
|
- update_dict = {'updTime':nowTime}
|
|
|
|
|
|
+ update_dict = {
|
|
|
|
+ 'updTime': nowTime,
|
|
|
|
+ 'ip': ip
|
|
|
|
+ }
|
|
if p2p_region:
|
|
if p2p_region:
|
|
update_dict['p2p_region'] = p2p_region
|
|
update_dict['p2p_region'] = p2p_region
|
|
if ucode:
|
|
if ucode:
|
|
update_dict['ucode'] = ucode
|
|
update_dict['ucode'] = ucode
|
|
if version:
|
|
if version:
|
|
update_dict['version'] = version
|
|
update_dict['version'] = version
|
|
|
|
+ if tz:
|
|
|
|
+ update_dict['tz'] = tz
|
|
|
|
+ if video_code:
|
|
|
|
+ update_dict['video'] = video_code
|
|
us_qs.update(**update_dict)
|
|
us_qs.update(**update_dict)
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
# 新增
|
|
# 新增
|
|
@@ -739,6 +750,7 @@ def update_device_shadow(request):
|
|
'uid': uid,
|
|
'uid': uid,
|
|
'addTime': nowTime,
|
|
'addTime': nowTime,
|
|
'updTime': nowTime,
|
|
'updTime': nowTime,
|
|
|
|
+ 'ip': ip
|
|
}
|
|
}
|
|
if p2p_region:
|
|
if p2p_region:
|
|
create_dict['p2p_region'] = p2p_region
|
|
create_dict['p2p_region'] = p2p_region
|
|
@@ -746,6 +758,10 @@ def update_device_shadow(request):
|
|
create_dict['ucode'] = ucode
|
|
create_dict['ucode'] = ucode
|
|
if version:
|
|
if version:
|
|
create_dict['version'] = version
|
|
create_dict['version'] = version
|
|
|
|
+ if tz:
|
|
|
|
+ create_dict['tz'] = tz
|
|
|
|
+ if video_code:
|
|
|
|
+ create_dict['video_code'] = video_code
|
|
UidSetModel.objects.create(**create_dict)
|
|
UidSetModel.objects.create(**create_dict)
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
else:
|
|
else:
|