diff --git a/fir_ser/api/utils/serializer.py b/fir_ser/api/utils/serializer.py index 099bfd7..23880f1 100644 --- a/fir_ser/api/utils/serializer.py +++ b/fir_ser/api/utils/serializer.py @@ -82,7 +82,7 @@ class AppsSerializer(serializers.ModelSerializer): class AppsShortSerializer(serializers.ModelSerializer): class Meta: model = models.Apps - fields = ["app_id","name","short","has_combo","isshow","description","need_password",'master_release'] + fields = ["app_id","name","short","has_combo","isshow","description","need_password",'master_release','type'] need_password=serializers.SerializerMethodField() diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py index cfc05b9..2816a91 100644 --- a/fir_ser/api/utils/storage/caches.py +++ b/fir_ser/api/utils/storage/caches.py @@ -62,8 +62,11 @@ def set_app_download_by_cache(app_id, limit=900): def del_cache_response_by_short(short,app_id): cache.delete("_".join([CACHE_KEY_TEMPLATE.get("download_short_key"),short])) - cache.delete("_".join([CACHE_KEY_TEMPLATE.get("app_instance_key"),app_id])) + key = "_".join([CACHE_KEY_TEMPLATE.get("download_short_key"),short,'*']) + for app_download_key in cache.iter_keys(key): + cache.delete(app_download_key) + cache.delete("_".join([CACHE_KEY_TEMPLATE.get("app_instance_key"),app_id])) key='ShortDownloadView'.lower() master_release_dict = AppReleaseInfo.objects.filter(app_id__app_id=app_id,is_master=True).values('icon_url','release_id').first() diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py index 59aa354..4257fa2 100644 --- a/fir_ser/api/views/download.py +++ b/fir_ser/api/views/download.py @@ -93,7 +93,8 @@ class ShortDownloadView(APIView): #key的设置 def calculate_cache_key(self, view_instance, view_method, request, args, kwargs): - return "_".join([settings.CACHE_KEY_TEMPLATE.get("download_short_key"), kwargs.get("short", None)]) + release_id = request.query_params.get("release_id", '') + return "_".join([settings.CACHE_KEY_TEMPLATE.get("download_short_key"), kwargs.get("short", ''),release_id]) class InstallView(APIView): '''