|
@@ -833,6 +833,7 @@ def update_uid_set(request):
|
|
|
# test.shadow.dvema.com
|
|
|
# 生产环境
|
|
|
# shadow.dvema.com
|
|
|
+# http://test.dvema.com/deviceShadow/update?etk=JVJWbFpFU0VOV1FsbEVTMFpOU2xKWFFURXhNVUU9Xz0=&ucode=1234&version=1324&p2p_region=CN
|
|
|
# 设备影子更新
|
|
|
def update_device_shadow(request):
|
|
|
request.encoding = 'utf-8'
|
|
@@ -865,6 +866,7 @@ def update_device_shadow(request):
|
|
|
push_status = request_dict.get('push_status', None)
|
|
|
pwd = request_dict.get('pwd', None)
|
|
|
resetTime = request_dict.get('resetTime', None)
|
|
|
+ is_alexa = request_dict.get('is_alexa', None)
|
|
|
|
|
|
us_qs = UidSetModel.objects.filter(uid=uid)
|
|
|
# 更新
|
|
@@ -873,64 +875,39 @@ def update_device_shadow(request):
|
|
|
print('-------')
|
|
|
print(resetTime)
|
|
|
print('-------')
|
|
|
-
|
|
|
+ qs_dict = {
|
|
|
+ 'updTime': nowTime,
|
|
|
+ 'ip': ip
|
|
|
+ }
|
|
|
+ if channel:
|
|
|
+ qs_dict['channel'] = channel
|
|
|
+ if p2p_region:
|
|
|
+ qs_dict['p2p_region'] = p2p_region
|
|
|
+ if ucode:
|
|
|
+ qs_dict['ucode'] = ucode
|
|
|
+ if version:
|
|
|
+ qs_dict['version'] = version
|
|
|
+ if tz:
|
|
|
+ qs_dict['tz'] = tz
|
|
|
+ if video_code:
|
|
|
+ qs_dict['video'] = video_code
|
|
|
+ if cloud_vod:
|
|
|
+ qs_dict['cloud_vod'] = cloud_vod
|
|
|
+ if push_status:
|
|
|
+ qs_dict['detect_status'] = push_status
|
|
|
+ if pwd:
|
|
|
+ qs_dict['pwd'] = pwd
|
|
|
+ if is_alexa:
|
|
|
+ qs_dict['is_alexa'] = is_alexa
|
|
|
if us_qs.exists():
|
|
|
- update_dict = {
|
|
|
- 'updTime': nowTime,
|
|
|
- 'ip': ip
|
|
|
- }
|
|
|
- if channel:
|
|
|
- update_dict['channel'] = channel
|
|
|
- if p2p_region:
|
|
|
- update_dict['p2p_region'] = p2p_region
|
|
|
- if ucode:
|
|
|
- update_dict['ucode'] = ucode
|
|
|
- if version:
|
|
|
- update_dict['version'] = version
|
|
|
- if tz:
|
|
|
- update_dict['tz'] = tz
|
|
|
- if video_code:
|
|
|
- update_dict['video'] = video_code
|
|
|
- if cloud_vod:
|
|
|
- update_dict['cloud_vod'] = cloud_vod
|
|
|
- if push_status:
|
|
|
- update_dict['detect_status'] = push_status
|
|
|
- if pwd:
|
|
|
- update_dict['pwd'] = pwd
|
|
|
- us_qs.update(**update_dict)
|
|
|
+ us_qs.update(**qs_dict)
|
|
|
# 如果推送状态开启,返回推送url
|
|
|
- data = {}
|
|
|
-
|
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
|
# 新增
|
|
|
else:
|
|
|
- create_dict = {
|
|
|
- 'uid': uid,
|
|
|
- 'addTime': nowTime,
|
|
|
- 'updTime': nowTime,
|
|
|
- 'ip': ip
|
|
|
- }
|
|
|
- if channel:
|
|
|
- create_dict['channel'] = channel
|
|
|
- if p2p_region:
|
|
|
- create_dict['p2p_region'] = p2p_region
|
|
|
- if ucode:
|
|
|
- create_dict['ucode'] = ucode
|
|
|
- if version:
|
|
|
- create_dict['version'] = version
|
|
|
- if tz:
|
|
|
- create_dict['tz'] = tz
|
|
|
- if video_code:
|
|
|
- create_dict['video_code'] = video_code
|
|
|
- if cloud_vod:
|
|
|
- create_dict['cloud_vod'] = cloud_vod
|
|
|
- if push_status:
|
|
|
- create_dict['detect_status'] = push_status
|
|
|
- if pwd:
|
|
|
- create_dict['pwd'] = pwd
|
|
|
- if resetTime:
|
|
|
- create_dict['resetTime'] = resetTime
|
|
|
- UidSetModel.objects.create(**create_dict)
|
|
|
+ qs_dict['uid'] = uid
|
|
|
+ qs_dict['addTime'] = nowTime
|
|
|
+ UidSetModel.objects.create(**qs_dict)
|
|
|
# 如果推送状态开启,返回推送url
|
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
|
else:
|