增加管理后台应用当天下载次数展示

dependabot/npm_and_yarn/fir_admin/terser-4.8.1
MMXX 2 years ago
parent 93c13fa776
commit 15a506450c
  1. 7
      fir_admin/src/views/appinfos/list.vue
  2. 5
      fir_admin/src/views/userinfos/list.vue
  3. 54
      fir_admin/src/views/wxbind/Detail.vue
  4. 17
      fir_admin/src/views/wxbind/list.vue
  5. 23
      fir_ser/admin/utils/serializer.py

@ -75,11 +75,16 @@
{{ scope.row.short }}
</template>
</el-table-column>
<el-table-column label="下载次数" width="100" align="center">
<el-table-column label="下载次数" width="80" align="center">
<template slot-scope="scope">
{{ scope.row.count_hits }}
</template>
</el-table-column>
<el-table-column label="当天下载次数" width="80" align="center">
<template slot-scope="scope">
{{ scope.row.today_hits_count }}
</template>
</el-table-column>
<el-table-column label="应用大小" width="80" align="center">
<template slot-scope="scope">
{{ scope.row.master_release.binary_size }}

@ -60,6 +60,11 @@
{{ scope.row.download_times }}
</template>
</el-table-column>
<el-table-column label="当天苹果|安卓下载次数" width="100" align="center">
<template slot-scope="scope">
{{ scope.row.today_hits_count.ios_today_hits_count }} | {{ scope.row.today_hits_count.android_today_hits_count }}
</template>
</el-table-column>
<el-table-column label="应用数量" width="100" align="center">
<template slot-scope="scope">
<router-link :to="{name: 'app_info_list',params:{user_id:scope.row.id}}">

@ -25,45 +25,54 @@
</el-col>
</el-row>
</el-form-item>
<el-form-item label="地址">
<el-row :gutter="12">
<el-col :span="16">
<el-input v-model="postForm.address" />
<el-form-item label="创建时间" prop="timestamp">
<el-row :gutter="20">
<el-col :span="8">
<el-date-picker :value="postForm.created_time" disabled type="datetime" />
</el-col>
</el-row>
</el-form-item>
<el-form-item label="创建时间" prop="timestamp">
<el-form-item label="订阅时间" prop="timestamp">
<el-row :gutter="20">
<el-col :span="8">
<el-date-picker :value="postForm.created_time" type="datetime" disabled />
<el-date-picker :value="postForm.subscribe_time*1000" disabled type="datetime" />
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户头像" label-width="160px">
<el-row :gutter="12">
<el-col :span="16">
<el-image :src="postForm.head_img_url" :preview-src-list="[postForm.head_img_url]" fit="contain" style="width: 100px; height: 100px" />
<el-image
:preview-src-list="[postForm.head_img_url]"
:src="postForm.head_img_url"
fit="contain"
style="width: 100px; height: 100px"
/>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="订阅状态" label-width="160px">
<el-form-item label="扫码登录" label-width="160px">
<el-row :gutter="12">
<el-col :span="16">
<el-select v-model="postForm.subscribe" class="filter-item">
<el-option v-for="item in wxbind_state_choices" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
<el-input v-model="postForm.enable_login" disabled />
</el-col>
</el-row>
</el-form-item>
<el-form-item label="性别" label-width="160px">
<el-form-item label="消息通知" label-width="160px">
<el-row :gutter="12">
<el-col :span="16">
<el-select v-model="postForm.sex" class="filter-item">
<el-option v-for="item in wxbind_sex_choices" :key="item.id" :label="item.name" :value="item.id" />
<el-input v-model="postForm.enable_notify" disabled />
</el-col>
</el-row>
</el-form-item>
<el-form-item label="订阅状态" label-width="160px">
<el-row :gutter="12">
<el-col :span="16">
<el-select v-model="postForm.subscribe" class="filter-item" disabled>
<el-option v-for="item in wxbind_state_choices" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-col>
</el-row>
@ -84,17 +93,12 @@
<script>
import { getWxBindInfos, updateWxBindInfo } from '@/api/wxbind'
const wxbind_state_choices = [
{ id: false, name: '未订阅' },
{ id: true, name: '已订阅' }
]
const wxbind_sex_choices = [
{ id: 0, name: '未知' },
{ id: 1, name: '男' },
{ id: 2, name: '女' }
]
const defaultForm = {
user_id: undefined,
address: undefined,
@ -103,9 +107,10 @@ const defaultForm = {
id: undefined,
nickname: undefined,
openid: undefined,
sex: undefined,
subscribe: undefined,
subscribe_time: undefined
subscribe_time: undefined,
enable_login: undefined,
enable_notify: undefined
}
export default {
@ -117,7 +122,6 @@ export default {
loading: false,
is_edit: false,
wxbind_state_choices,
wxbind_sex_choices,
id: ''
}
},

@ -50,14 +50,14 @@
{{ scope.row.openid }}
</template>
</el-table-column>
<el-table-column label="地址" min-width="200px" align="center">
<el-table-column label="允许扫码登录" min-width="100px" align="center">
<template slot-scope="scope">
{{ scope.row.address }}
{{ scope.row.enable_login }}
</template>
</el-table-column>
<el-table-column label="性别" min-width="60px" align="center">
<el-table-column label="允许消息通知" min-width="100px" align="center">
<template slot-scope="scope">
{{ scope.row |sexLableFilter }}
{{ scope.row.enable_notify }}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="订阅状态" width="95" align="center">
@ -107,12 +107,6 @@ const wxbind_state_choices = [
{ id: true, name: '已订阅' }
]
const wxbind_sex_choices = [
{ id: 0, name: '未知' },
{ id: 1, name: '男' },
{ id: 2, name: '女' }
]
export default {
name: 'WxBindInfo',
components: { Pagination },
@ -139,9 +133,6 @@ export default {
statusLableFilter(row) {
return baseFilter(row.subscribe, wxbind_state_choices)
},
sexLableFilter(row) {
return baseFilter(row.sex, wxbind_sex_choices)
},
statusFilter(status) {
const statusMap = {
true: 'success',

@ -4,9 +4,11 @@ import os
from rest_framework import serializers
from api import models
from api.models import Apps
from api.utils.serializer import AppReleaseSerializer, UserInfoSerializer, AppsSerializer, StorageSerializer, \
ThirdWxSerializer, DomainNameSerializer, AppReportSerializer
ThirdWxSerializer, DomainNameSerializer, AppReportSerializer, OrdersSerializer
from common.base.baseutils import get_choices_dict, get_choices_name_from_key
from common.utils.caches import get_app_today_download_times
from common.utils.storage import Storage
logger = logging.getLogger(__name__)
@ -92,6 +94,18 @@ class AdminUserInfoSerializer(UserInfoSerializer):
def get_app_count(self, obj):
return models.Apps.objects.filter(user_id=obj).count()
today_hits_count = serializers.SerializerMethodField()
def get_today_hits_count(self, obj):
android_app_ids = Apps.objects.filter(**{"user_id": obj, "type": 0}).values('app_id')
android_app_ids = [app_dict.get('app_id') for app_dict in android_app_ids]
ios_app_ids = Apps.objects.filter(**{"user_id": obj, "type": 1}).values('app_id')
ios_app_ids = [app_dict.get('app_id') for app_dict in ios_app_ids]
return {
"android_today_hits_count": get_app_today_download_times(android_app_ids),
"ios_today_hits_count": get_app_today_download_times(ios_app_ids)
}
def update(self, instance, validated_data):
return super(AdminUserInfoSerializer, self).update(instance, validated_data)
@ -122,6 +136,11 @@ 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)
@ -162,7 +181,7 @@ class AdminStorageSerializer(StorageSerializer):
used_id = serializers.IntegerField(source="user_id.pk")
class AdminOrdersSerializer(serializers.ModelSerializer):
class AdminOrdersSerializer(OrdersSerializer):
class Meta:
model = models.Order
fields = "__all__"

Loading…
Cancel
Save