|
@@ -637,8 +637,9 @@ 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',
|
|
qs = UidSetModel.objects.filter(uid=uid).values('uid', 'detect_status', 'detect_interval', 'version', 'ucode',
|
|
- 'p2p_region')
|
|
|
|
|
|
+ 'p2p_region', 'tz', 'video_code', 'channel', 'cloud_vod')
|
|
# 判断uid配置表信息是否存在
|
|
# 判断uid配置表信息是否存在
|
|
if qs.exists():
|
|
if qs.exists():
|
|
data = {
|
|
data = {
|
|
@@ -646,7 +647,11 @@ 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'],
|
|
|
|
+ 'tz': qs[0]['tz'],
|
|
|
|
+ 'video_code': qs[0]['video_code'],
|
|
|
|
+ 'channel': qs[0]['channel'],
|
|
|
|
+ 'cloud_vod': qs[0]['cloud_vod'],
|
|
}
|
|
}
|
|
# 查询云存储相关信息
|
|
# 查询云存储相关信息
|
|
ubqs = UID_Bucket.objects.filter(uid=uid). \
|
|
ubqs = UID_Bucket.objects.filter(uid=uid). \
|
|
@@ -724,6 +729,13 @@ def update_device_shadow(request):
|
|
tz = request_dict.get('tz', None)
|
|
tz = request_dict.get('tz', None)
|
|
video_code = request_dict.get('video_code', None)
|
|
video_code = request_dict.get('video_code', None)
|
|
ip = CommonService.get_ip_address(request)
|
|
ip = CommonService.get_ip_address(request)
|
|
|
|
+ is_reset = request_dict.get('is_reset', None)
|
|
|
|
+ channel = request_dict.get('channel', None)
|
|
|
|
+ cloud_vod = request_dict.get('cloud_vod', None)
|
|
|
|
+ push_status = request_dict.get('push_status', None)
|
|
|
|
+ # 传1则重置设备信息
|
|
|
|
+ if is_reset == 1:
|
|
|
|
+ UidSetModel.objects.filter(uid=uid).delete()
|
|
us_qs = UidSetModel.objects.filter(uid=uid)
|
|
us_qs = UidSetModel.objects.filter(uid=uid)
|
|
# 更新
|
|
# 更新
|
|
nowTime = int(time.time())
|
|
nowTime = int(time.time())
|
|
@@ -732,6 +744,8 @@ def update_device_shadow(request):
|
|
'updTime': nowTime,
|
|
'updTime': nowTime,
|
|
'ip': ip
|
|
'ip': ip
|
|
}
|
|
}
|
|
|
|
+ if channel:
|
|
|
|
+ update_dict['channel'] = channel
|
|
if p2p_region:
|
|
if p2p_region:
|
|
update_dict['p2p_region'] = p2p_region
|
|
update_dict['p2p_region'] = p2p_region
|
|
if ucode:
|
|
if ucode:
|
|
@@ -742,6 +756,14 @@ def update_device_shadow(request):
|
|
update_dict['tz'] = tz
|
|
update_dict['tz'] = tz
|
|
if video_code:
|
|
if video_code:
|
|
update_dict['video'] = video_code
|
|
update_dict['video'] = video_code
|
|
|
|
+ if cloud_vod:
|
|
|
|
+ update_dict['cloud_vod'] = cloud_vod
|
|
|
|
+ if push_status:
|
|
|
|
+ update_dict['push_status'] = push_status
|
|
|
|
+ if account:
|
|
|
|
+ update_dict['account'] = account
|
|
|
|
+ if password:
|
|
|
|
+ update_dict['password'] = password
|
|
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': {}})
|
|
# 新增
|
|
# 新增
|
|
@@ -752,6 +774,8 @@ def update_device_shadow(request):
|
|
'updTime': nowTime,
|
|
'updTime': nowTime,
|
|
'ip': ip
|
|
'ip': ip
|
|
}
|
|
}
|
|
|
|
+ if channel:
|
|
|
|
+ create_dict['channel'] = channel
|
|
if p2p_region:
|
|
if p2p_region:
|
|
create_dict['p2p_region'] = p2p_region
|
|
create_dict['p2p_region'] = p2p_region
|
|
if ucode:
|
|
if ucode:
|
|
@@ -762,6 +786,14 @@ def update_device_shadow(request):
|
|
create_dict['tz'] = tz
|
|
create_dict['tz'] = tz
|
|
if video_code:
|
|
if video_code:
|
|
create_dict['video_code'] = video_code
|
|
create_dict['video_code'] = video_code
|
|
|
|
+ if cloud_vod:
|
|
|
|
+ create_dict['cloud_vod'] = cloud_vod
|
|
|
|
+ if push_status:
|
|
|
|
+ create_dict['push_status'] = push_status
|
|
|
|
+ if account:
|
|
|
|
+ create_dict['account'] = account
|
|
|
|
+ if password:
|
|
|
|
+ create_dict['password'] = password
|
|
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:
|