Przeglądaj źródła

给推送数据信息存储位置字段添加索引

lhq 4 lat temu
rodzic
commit
fc739fa13b
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      Controller/PcInfo.py

+ 4 - 1
Controller/PcInfo.py

@@ -170,6 +170,7 @@ class PcInfo(View):
                     return response.json(500)
 
     def query(self, request_dict, response):
+        pc_name = request_dict.get('pc_name', None)
         package = request_dict.get('package', None)
         file_type = request_dict.get('file_type', None)
         q = Pc_Info.objects.filter(file_type=file_type).filter(package=package)
@@ -180,7 +181,9 @@ class PcInfo(View):
             queryset = Pc_Info.objects.filter(package=package)
         elif file_type and package is None:
             queryset = Pc_Info.objects.filter(file_type=file_type)
-        else:
+        elif pc_name and file_type:
+            queryset = Pc_Info.objects.filter(pc_name=pc_name).filter(file_type=file_type)
+        elif file_type and package:
             queryset = Pc_Info.objects.filter(file_type=file_type).filter(package=package)
         count = queryset.count()
         res = queryset