ソースを参照

PC查询优化

lhq 4 年 前
コミット
094911aad6
1 ファイル変更7 行追加7 行削除
  1. 7 7
      Controller/PcInfo.py

+ 7 - 7
Controller/PcInfo.py

@@ -174,18 +174,18 @@ class PcInfo(View):
         pc_test = request_dict.get('pc_test', None)
         package = request_dict.get('package', None)
         file_type = request_dict.get('file_type', None)
-        if package and file_type is None and pc_name is None:
+        # 根据传的参数筛选,没传时返回全部
+        queryset = Pc_Info.objects.all()
+        if package:
             queryset = Pc_Info.objects.filter(package=package)
-        elif file_type and package is None and pc_name is None:
+        if file_type:
             queryset = Pc_Info.objects.filter(file_type=file_type)
-        elif pc_name and file_type and package is None:
+        if pc_name and file_type:
             queryset = Pc_Info.objects.filter(pc_name=pc_name, file_type=file_type)
-        elif file_type and package and pc_name is None:
+        if file_type and package:
             queryset = Pc_Info.objects.filter(file_type=file_type, package=package)
-        elif pc_name and bundle_version and pc_version and pc_test:
+        if pc_name and bundle_version and pc_version and pc_test:
             queryset = Pc_Info.objects.filter(pc_name=pc_name, bundle_version=bundle_version, pc_version=pc_version, pc_test=pc_test)
-        else:
-            queryset = Pc_Info.objects.all()
         count = queryset.count()
         res = queryset
         send_json = CommonService.qs_to_dict(res)