|
@@ -239,10 +239,14 @@ class deviceStatus(TemplateView):
|
|
|
if not alexAuth.exists():
|
|
|
logger.info('UID为 {} 的用户不存在'.format(UID))
|
|
|
return JsonResponse({'code': 102, 'msg': 'not found user'})
|
|
|
+
|
|
|
expiresTime = alexAuth[0]['expiresTime']
|
|
|
access_token = alexAuth[0]['access_token']
|
|
|
refresh_token = alexAuth[0]['refresh_token']
|
|
|
alexa_region = alexAuth[0]['alexa_region']
|
|
|
+ if alexa_region not in ALEXA_EVENT_API.keys():
|
|
|
+ logger.info('alexa区域信息错误,alexa_region: {}'.format(alexa_region))
|
|
|
+ return JsonResponse({'code': 102, 'msg': 'alexa_region error'})
|
|
|
|
|
|
# 更新alexa token
|
|
|
now_time = int(time.time())
|
|
@@ -360,7 +364,7 @@ class deviceStatus(TemplateView):
|
|
|
UID = request_dict.get("UID", '')
|
|
|
userID = request_dict.get("userID", '')
|
|
|
logger = logging.getLogger('django')
|
|
|
- logger.info('class:deviceStatus-------function:delete------------------')
|
|
|
+ logger.info('--------删除设备--------')
|
|
|
logger.info('userID: {}, UID: {}'.format(userID, UID))
|
|
|
if not all([UID, userID]):
|
|
|
return JsonResponse({'code': 111, 'msg': 'fail'})
|
|
@@ -369,14 +373,16 @@ class deviceStatus(TemplateView):
|
|
|
alexAuth = AlexaAuthModel.objects.filter(userID=userID).\
|
|
|
values('expiresTime', 'refresh_token', 'access_token', 'alexa_region')
|
|
|
if not alexAuth.exists():
|
|
|
+ logger.info('UID为 {} 的用户不存在'.format(UID))
|
|
|
return JsonResponse({'code': 102, 'msg': 'not found user'})
|
|
|
|
|
|
expiresTime = alexAuth[0]['expiresTime']
|
|
|
refresh_token = alexAuth[0]['refresh_token']
|
|
|
access_token = alexAuth[0]['access_token']
|
|
|
alexa_region = alexAuth[0]['alexa_region']
|
|
|
- logger.info('expiresTime: {}, refresh_token: {}, access_token: {}, alexa_region: {}'.
|
|
|
- format(expiresTime, refresh_token, access_token, alexa_region))
|
|
|
+ if alexa_region not in ALEXA_EVENT_API.keys():
|
|
|
+ logger.info('alexa区域信息错误,alexa_region: {}'.format(alexa_region))
|
|
|
+ return JsonResponse({'code': 102, 'msg': 'alexa_region error'})
|
|
|
|
|
|
now_time = int(time.time())
|
|
|
if now_time > expiresTime:
|