From 7aa0471ba992e453234fb3d22b47ae066bab97de Mon Sep 17 00:00:00 2001 From: isummer Date: Wed, 3 Aug 2022 15:17:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=94=E7=94=A8=E5=BD=93?= =?UTF-8?q?=E5=A4=A9=E4=B8=8B=E8=BD=BD=E6=AC=A1=E6=95=B0=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/apps/FirAppInfosBase.vue | 42 ++++++++++--------- fir_client/src/components/apps/FirApps.vue | 5 ++- fir_ser/admin/utils/serializer.py | 5 --- fir_ser/api/utils/serializer.py | 8 +++- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/fir_client/src/components/apps/FirAppInfosBase.vue b/fir_client/src/components/apps/FirAppInfosBase.vue index 61c868f..d7c8be6 100644 --- a/fir_client/src/components/apps/FirAppInfosBase.vue +++ b/fir_client/src/components/apps/FirAppInfosBase.vue @@ -13,28 +13,32 @@ class="bundleid short" > {{ appinfos.preview_url }} - - -
- - - 保存本地 -
- - 下载码 -
+ + + +
+ + + 保存本地 +
+ 下载码 +
+
{{ master_release.release_type |getapptype }} - - {{ appinfos.count_hits }} + +
总下载次数:{{ appinfos.count_hits }}
当天下载次数:{{ appinfos.today_hits_count }}
+ {{ + appinfos.count_hits + }}  |  {{ appinfos.today_hits_count }}
BundleID diff --git a/fir_client/src/components/apps/FirApps.vue b/fir_client/src/components/apps/FirApps.vue index e272d86..3af0aa2 100644 --- a/fir_client/src/components/apps/FirApps.vue +++ b/fir_client/src/components/apps/FirApps.vue @@ -491,7 +491,10 @@
- {{ r.count_hits }} + +
总下载次数:{{ r.count_hits }}
当天下载次数:{{ r.today_hits_count }}
+ {{ r.count_hits }}  |  {{ r.today_hits_count }} +
diff --git a/fir_ser/admin/utils/serializer.py b/fir_ser/admin/utils/serializer.py index c687799..ab31b35 100644 --- a/fir_ser/admin/utils/serializer.py +++ b/fir_ser/admin/utils/serializer.py @@ -136,11 +136,6 @@ class AdminAppsSerializer(AppsSerializer): def get_release_count(self, obj): return models.AppReleaseInfo.objects.filter(app_id=obj).count() - today_hits_count = serializers.SerializerMethodField() - - def get_today_hits_count(self, obj): - return get_app_today_download_times([obj.app_id]) - def update(self, instance, validated_data): return super(AdminAppsSerializer, self).update(instance, validated_data) diff --git a/fir_ser/api/utils/serializer.py b/fir_ser/api/utils/serializer.py index 56844ea..2c18047 100644 --- a/fir_ser/api/utils/serializer.py +++ b/fir_ser/api/utils/serializer.py @@ -12,7 +12,7 @@ from api.utils.modelutils import get_user_domain_name, get_app_domain_name, get_ from common.base.baseutils import get_choices_dict, WeixinLoginUid from common.cache.storage import AdPicShowCache from common.core.sysconfig import Config, UserConfig -from common.utils.caches import get_user_free_download_times, get_user_cert_auth_status +from common.utils.caches import get_user_free_download_times, get_user_cert_auth_status, get_app_today_download_times from common.utils.storage import Storage from common.utils.token import make_token @@ -216,12 +216,16 @@ class AppsSerializer(serializers.ModelSerializer): else: return {} + today_hits_count = serializers.SerializerMethodField() + + def get_today_hits_count(self, obj): + return get_app_today_download_times([obj.app_id]) class AppsListSerializer(AppsSerializer): class Meta: model = models.Apps fields = ["app_id", "bundle_id", "issupersign", "name", "preview_url", "short", "type", "master_release", - "has_combo", "count_hits"] + "has_combo", "count_hits", "today_hits_count"] def get_master_release(self, obj): master_release_obj = get_app_master_obj_from_context(self, obj)