|
@@ -547,10 +547,9 @@ def getNewVerInterface(request):
|
|
|
redisObject.set_data(device_info_key, device_info_value, expire)
|
|
|
|
|
|
url_tko = UrlTokenObject()
|
|
|
- file_path = url_tko.generate(data={'Url': 'aws', 'uid': device_info_key})
|
|
|
+ file_path = url_tko.generate(data={'Url': 'a', 'uid': str_uuid})
|
|
|
|
|
|
url = SERVER_DOMAIN + 'dlotapack/' + file_path
|
|
|
- logger.info('<<<<<<<获取ota token={}'.format(file_path))
|
|
|
logger.info('<<<<<<<URL={}'.format(url))
|
|
|
# if SERVER_TYPE == 'Ansjer.formal_settings':
|
|
|
# url = SERVER_DOMAIN + 'dlotapack/' + file_path
|
|
@@ -560,13 +559,13 @@ def getNewVerInterface(request):
|
|
|
# url = 'http://www.zositech.xyz/dlotapack/' + file_path
|
|
|
# else:
|
|
|
# url = SERVER_DOMAIN + 'dlotapack/' + file_path
|
|
|
- result = response.json(0, {
|
|
|
+ result = {
|
|
|
'ver': ver,
|
|
|
'url': url,
|
|
|
"Description": equipment.Description,
|
|
|
- })
|
|
|
- logger.info('<<<<<响应结果={},{},{}'.format(ver, url, equipment.Description))
|
|
|
- return result
|
|
|
+ }
|
|
|
+ logger.info('<<<<<响应结果={}'.format(result))
|
|
|
+ return response.json(0, result)
|
|
|
else:
|
|
|
return response.json(902)
|
|
|
else:
|
|
@@ -686,18 +685,18 @@ def downloadOTAInterfaceV2(request, fullPath, *callback_args, **callback_kwargs)
|
|
|
# mci = url_token.mci
|
|
|
# old_version = url_token.old_version
|
|
|
# new_version = url_token.new_version
|
|
|
- device_key = url_token.uid
|
|
|
+ str_uuid = url_token.uid
|
|
|
logger = logging.getLogger('info')
|
|
|
logger.info('<<<<<进入OTA下载')
|
|
|
redis_object = RedisObject()
|
|
|
- logger.info(device_key)
|
|
|
+ logger.info(str_uuid)
|
|
|
+ device_key = 'ASJ:SERVER:DEVICE:VERSION:{}'.format(str_uuid)
|
|
|
device_value = redis_object.get_data(device_key)
|
|
|
logger.info(device_value)
|
|
|
if not device_value:
|
|
|
return res.json(907)
|
|
|
device_dist = json.loads(device_value)
|
|
|
- logger.info('<<<<<解析')
|
|
|
- logger.info(device_dist)
|
|
|
+ logger.info('<<<<<解析={}'.format(device_dist))
|
|
|
fp = device_dist['Url']
|
|
|
serial_number = device_dist['serial_number']
|
|
|
uid = device_dist['uid']
|
|
@@ -705,7 +704,6 @@ def downloadOTAInterfaceV2(request, fullPath, *callback_args, **callback_kwargs)
|
|
|
mci = device_dist['mci']
|
|
|
old_version = device_dist['old_version']
|
|
|
new_version = device_dist['new_version']
|
|
|
- logger.info('URL={}'.format(fp))
|
|
|
if '' == fp:
|
|
|
return res.json(907)
|
|
|
|
|
@@ -736,6 +734,8 @@ def downloadOTAInterfaceV2(request, fullPath, *callback_args, **callback_kwargs)
|
|
|
uid=uid,
|
|
|
mci=mci,
|
|
|
)
|
|
|
+ del_data = redis_object.del_data(device_key)
|
|
|
+ logger.info('删除缓存={}'.format(del_data))
|
|
|
return response
|
|
|
except Exception as e:
|
|
|
return res.json(906, repr(e))
|