增加应用当天下载次数展示

pull/26/merge
isummer 2 years ago
parent 2224ce27c7
commit 7aa0471ba9
  1. 42
      fir_client/src/components/apps/FirAppInfosBase.vue
  2. 5
      fir_client/src/components/apps/FirApps.vue
  3. 5
      fir_ser/admin/utils/serializer.py
  4. 8
      fir_ser/api/utils/serializer.py

@ -13,28 +13,32 @@
class="bundleid short" class="bundleid short"
>&nbsp;{{ appinfos.preview_url }}</span> >&nbsp;{{ appinfos.preview_url }}</span>
</el-tooltip> </el-tooltip>
<el-tooltip content="点击查看下载码">
<el-popover
placement="right" <el-popover
width="288"> placement="right"
<div style="text-align: center; margin: 0"> width="288">
<vue-qr ref="qr" <div style="text-align: center; margin: 0">
:correctLevel="qrinfo.correctLevel" :logoCornerRadius="qrinfo.logoCornerRadius" <vue-qr ref="qr"
:logoScale="qrinfo.logoScale" :correctLevel="qrinfo.correctLevel" :logoCornerRadius="qrinfo.logoCornerRadius"
:logoSrc="icon_url" :logoScale="qrinfo.logoScale"
:margin="qrinfo.margin" :size="266" :logoSrc="icon_url"
:text="appinfos.preview_url"> :margin="qrinfo.margin" :size="266"
</vue-qr> :text="appinfos.preview_url">
<el-button size="small" type="primary" @click="save_qr()">保存本地</el-button> </vue-qr>
</div> <el-button size="small" type="primary" @click="save_qr()">保存本地</el-button>
</div>
<span slot="reference" class="short ng-scope">下载码</span> <span slot="reference" class="short ng-scope">下载码</span>
</el-popover> </el-popover>
</el-tooltip>
<span>{{ master_release.release_type |getapptype }}</span> <span>{{ master_release.release_type |getapptype }}</span>
<el-tooltip content="下载量" placement="top"> <el-tooltip placement="top">
<span><i class="el-icon-cloudy"/><b class="short">{{ appinfos.count_hits }}</b></span> <div slot="content">总下载次数{{ appinfos.count_hits }}<br/>当天下载次数{{ appinfos.today_hits_count }}</div>
<span><i class="el-icon-cloudy"/><b class="short">{{
appinfos.count_hits
}} &nbsp;|&nbsp; {{ appinfos.today_hits_count }} </b></span>
</el-tooltip> </el-tooltip>
<span class="bundleid ng-binding">BundleID<b class="ng-binding"> <span class="bundleid ng-binding">BundleID<b class="ng-binding">
<el-tooltip content="复制到剪切板" placement="top"> <el-tooltip content="复制到剪切板" placement="top">

@ -491,7 +491,10 @@
<div class=" app-animator"> <div class=" app-animator">
<div class="card app card-ios"> <div class="card app card-ios">
<i class="down-icon el-icon-cloudy"> {{ r.count_hits }}</i> <el-tooltip>
<div slot="content">总下载次数{{ r.count_hits }}<br/>当天下载次数{{ r.today_hits_count }}</div>
<i class="down-icon el-icon-cloudy"> {{ r.count_hits }} &nbsp;|&nbsp; {{ r.today_hits_count }}</i>
</el-tooltip>
<i v-if="r.type === 1" class="type-icon iconfont icon-ios"/> <i v-if="r.type === 1" class="type-icon iconfont icon-ios"/>
<i v-if="r.type === 0" class="type-icon iconfont icon-android2"/> <i v-if="r.type === 0" class="type-icon iconfont icon-android2"/>

@ -136,11 +136,6 @@ class AdminAppsSerializer(AppsSerializer):
def get_release_count(self, obj): def get_release_count(self, obj):
return models.AppReleaseInfo.objects.filter(app_id=obj).count() 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): def update(self, instance, validated_data):
return super(AdminAppsSerializer, self).update(instance, validated_data) return super(AdminAppsSerializer, self).update(instance, validated_data)

@ -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.base.baseutils import get_choices_dict, WeixinLoginUid
from common.cache.storage import AdPicShowCache from common.cache.storage import AdPicShowCache
from common.core.sysconfig import Config, UserConfig 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.storage import Storage
from common.utils.token import make_token from common.utils.token import make_token
@ -216,12 +216,16 @@ class AppsSerializer(serializers.ModelSerializer):
else: else:
return {} 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 AppsListSerializer(AppsSerializer):
class Meta: class Meta:
model = models.Apps model = models.Apps
fields = ["app_id", "bundle_id", "issupersign", "name", "preview_url", "short", "type", "master_release", 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): def get_master_release(self, obj):
master_release_obj = get_app_master_obj_from_context(self, obj) master_release_obj = get_app_master_obj_from_context(self, obj)

Loading…
Cancel
Save