|
@@ -72,16 +72,16 @@ def update_device_shadow(request):
|
|
|
try:
|
|
|
try:
|
|
|
etk = request_dict.get('etk', None)
|
|
|
+ shadow_key = 'PUSH:DEVICE:SHADOW:{}'.format(etk)
|
|
|
+ device_etk = redis_obj.get_data(key=shadow_key)
|
|
|
+ if device_etk:
|
|
|
+ return JsonResponse(status=200,
|
|
|
+ data={'code': 0, 'msg': 'The same UID is requested once a day', 'data': {}})
|
|
|
+ redis_obj.set_data(key=shadow_key, val=1, expire=3600 * 24)
|
|
|
eto = ETkObject(etk)
|
|
|
uid = eto.uid
|
|
|
if not uid:
|
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
|
- shadow_key = 'PUSH:DEVICE:SHADOW:{}'.format(uid)
|
|
|
- device_uid = redis_obj.get_data(key=shadow_key)
|
|
|
- if device_uid:
|
|
|
- return JsonResponse(status=200,
|
|
|
- data={'code': 0, 'msg': 'The same UID is requested once a day', 'data': {}})
|
|
|
- redis_obj.set_data(key=shadow_key, val=1, expire=3600 * 24)
|
|
|
except Exception:
|
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
|
|