Selaa lähdekoodia

app获取设备图标接口添加备注

guanhailong 2 vuotta sitten
vanhempi
commit
058266931d
1 muutettua tiedostoa jossa 7 lisäystä ja 10 poistoa
  1. 7 10
      AdminController/DeviceManagementController.py

+ 7 - 10
AdminController/DeviceManagementController.py

@@ -463,7 +463,7 @@ class DeviceManagement(View):
             return response.json(444)
         if lang != 'cn':
             lang = 'en'
-        if version_number >= '2.6.2.1':
+        if version_number >= '2.6.2.1':  # 判断是否低于2.6.2.1版本
             return self.newAppVersion(response, app_bundle_id, lang, version_number)  # 获取2.6.2.1及以上版本设备信息图标
         else:
             version_number_qs = AppVersionNumber.objects.filter(app_bundle__app_bundle_id=app_bundle_id,
@@ -473,7 +473,7 @@ class DeviceManagement(View):
                 if not version_number_qs.exists():
                     return response.json(173)
                 version_qs = version_number_qs.values('version_number')
-                test_list = [item[key] for item in version_qs for key in item]
+                test_list = [item[key] for item in version_qs for key in item]  # 判断该版本最靠进已有版本号
                 if version_number > test_list[-1] or version_number < test_list[0]:
                     version_number_qs = version_number_qs.filter().values('id').order_by('id')
                     total_list = [item[key] for item in version_number_qs for key in item]
@@ -521,13 +521,13 @@ class DeviceManagement(View):
         # 获取版本号
         try:
             app_bundle_list = []
-            version_qs = version_number_qs.filter(version_number=version_number).values('version_number')
+            version_qs = version_number_qs.filter(version_number=version_number).values('version_number')  # 判断版本是否存在
             if version_qs.exists():
                 version_number = version_qs[0]['version_number']
             else:
-                all_version_number_qs = version_number_qs.values('version_number')
+                all_version_number_qs = version_number_qs.values('version_number')  # 输入版本号不存在,则获取全部版本号
                 test_list = [item[key] for item in all_version_number_qs for key in item]
-                if version_number > test_list[-1] or version_number < test_list[0]:
+                if version_number > test_list[-1] or version_number < test_list[0]:  # 判断该版本最靠进已有版本号
                     version_qs = version_number_qs.filter().values('version_number').order_by('version_number')
                     total_list = [item[key] for item in version_qs for key in item]
                     version_number = total_list[-1]
@@ -541,11 +541,8 @@ class DeviceManagement(View):
                     version_qs = AppVersionNumber.objects.filter(version_number=before).values('version_number')
                     version_number = version_qs[0]['version_number']
             all_version_list = [item[key] for item in version_number_qs for key in item]
-            # if version_number in all_version_list:
-            #     index = all_version_list.index(version_number)
-            # else:
-            index = all_version_list.index(version_number)  # 根据版本号获取设备信息图标
-            if app_bundle_id == 'com.ansjer.zccloud' or app_bundle_id == 'com.ansjer.zccloud_a':
+            index = all_version_list.index(version_number)  # 获取版本号的索引
+            if app_bundle_id == 'com.ansjer.zccloud' or app_bundle_id == 'com.ansjer.zccloud_a':  # 判断App包
                 version_number_qs = version_number_qs.values('version_number')[0:index + 1]
             else:
                 version_number_qs = version_number_qs.values('version_number')[1:index + 1]