From 118564577e2d4d2f5e8914f0a1252c90e1974416 Mon Sep 17 00:00:00 2001 From: Bai Date: Wed, 16 Sep 2020 19:52:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(command):=20=E4=BF=AE=E5=A4=8D=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=AF=BC=E5=87=BA=E9=80=89=E4=B8=AD=E9=A1=B9=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/api/command.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/apps/terminal/api/command.py b/apps/terminal/api/command.py index d6600f0c6..d18c70858 100644 --- a/apps/terminal/api/command.py +++ b/apps/terminal/api/command.py @@ -3,7 +3,6 @@ import time from django.utils import timezone from django.shortcuts import HttpResponse -from django.core.cache import cache from rest_framework import viewsets from rest_framework import generics from rest_framework.fields import DateTimeField @@ -14,7 +13,6 @@ from django.template import loader from orgs.utils import current_org from common.permissions import IsOrgAdminOrAppUser, IsOrgAuditor from common.utils import get_logger -from common import const from ..backends import ( get_command_storage, get_multi_command_storage, SessionCommandSerializer, @@ -64,23 +62,8 @@ class CommandQueryMixin: ) return queryset - def filter_queryset_spm(self, queryset): - spm = self.request.query_params.get('spm') - if not spm: - return queryset - cache_key = const.KEY_CACHE_RESOURCES_ID.format(spm) - resources_id = cache.get(cache_key) - if resources_id is None or not isinstance(resources_id, list): - return queryset - if isinstance(queryset, list): - queryset = [q for q in queryset if q['id'] in resources_id] - else: - queryset = queryset.filter(id__in=resources_id) - return queryset - def filter_queryset(self, queryset): # 解决es存储命令时,父类根据filter_fields过滤出现异常的问题,返回的queryset类型list - queryset = self.filter_queryset_spm(queryset) return queryset def get_date_range(self):