|
@@ -708,7 +708,7 @@ def getDownLoadOTApackUrl(request):
|
|
|
file_path = equipmentVersion[0].filePath
|
|
|
if file_path:
|
|
|
if file_path.find('static/otapack') != -1: # 只下载otapack路径下的文件
|
|
|
- url = SERVER_DOMAIN + 'OTA/downloadsPack/' + file_path # 复用以前的文件下载方式
|
|
|
+ url = SERVER_DOMAIN + 'OTA/downloadsPack/' + file_path # 复用app下载ota包的方式
|
|
|
# SERVER_DOMAIN = 'https://test.dvema.com/'
|
|
|
# url = SERVER_DOMAIN + 'OTA/downloadsPack/' + file_path
|
|
|
res = {
|
|
@@ -723,7 +723,7 @@ def getDownLoadOTApackUrl(request):
|
|
|
|
|
|
@csrf_exempt
|
|
|
def checkMaxVersion(request):
|
|
|
- # QT检查ota设备软件版本是否为最新版本
|
|
|
+ # QT检查ota设备软件版本是否需要更新
|
|
|
response = ResponseObject()
|
|
|
if request.method == "POST":
|
|
|
request_dict = request.POST
|
|
@@ -733,24 +733,26 @@ def checkMaxVersion(request):
|
|
|
return response.json(444)
|
|
|
deviceType = request_dict.get('deviceType', None)
|
|
|
version = request_dict.get('version', None) # 设备版本:当前版本+设备规格代码
|
|
|
+ lang = request_dict.get('lang', None) # 'zh-Hans','en'
|
|
|
if not deviceType or not version:
|
|
|
return response.json(444, 'deviceType or version')
|
|
|
- equipmentVersion = Equipment_Version.objects.filter(mci=deviceType, version=version)
|
|
|
+ now_version = version[:version.rindex('.')]
|
|
|
+ code = version[version.rindex('.')+1:]
|
|
|
+ equipmentVersion = Equipment_Version.objects.filter(mci=deviceType, code=code, lang=lang, status=1) # order by data_joined
|
|
|
# 判断是否有该版本存在
|
|
|
if not equipmentVersion.exists():
|
|
|
return response.json(907)
|
|
|
- # now_version = version[:version.rindex('.')]
|
|
|
- # code = version[version.rindex('.')+1:]
|
|
|
|
|
|
- file_path = equipmentVersion[0].filePath
|
|
|
- softwareVersion = equipmentVersion[0].softwareVersion
|
|
|
- max_version = equipmentVersion[0].max_ver
|
|
|
- if softwareVersion < max_version:
|
|
|
- # 当前版本小于最大版本,返回文件下载链接
|
|
|
- url = SERVER_DOMAIN + 'OTA/downloadsPack/' + file_path
|
|
|
- res = {
|
|
|
- "url": url,
|
|
|
- }
|
|
|
- return response.json(0, res)
|
|
|
- else:
|
|
|
+ filePath = equipmentVersion[0].filePath
|
|
|
+ softwareVersion = equipmentVersion[0].softwareVersion # 可用最新版本的版本号
|
|
|
+ maxVersion = equipmentVersion[0].max_ver
|
|
|
+ if now_version >= softwareVersion:
|
|
|
+ # 当前版本大于等于最新版本,不需要更新
|
|
|
return response.json(902)
|
|
|
+ url = SERVER_DOMAIN + 'OTA/downloadsPack/' + filePath # 复用app下载ota包的方式
|
|
|
+ res = {
|
|
|
+ 'url': url,
|
|
|
+ }
|
|
|
+ return response.json(0, res)
|
|
|
+
|
|
|
+
|