优化设备消耗展示

pull/37/head
nineven 3 years ago
parent 05669b8d3e
commit 24a8307164
  1. 51
      fir_client/src/components/user/FirSuperSignBase.vue
  2. 58
      fir_ser/xsign/utils/modelutils.py
  3. 4
      fir_ser/xsign/utils/serializer.py

@ -346,13 +346,36 @@
</el-select>
<div style="width: 45%;margin-right: 20px;float:right;margin-bottom: 10px">
<el-link :underline="false">总设备量{{ developer_used_info.all_usable_number }} 已使用平台{{
developer_used_info.all_use_number
}} 其他{{ developer_used_info.other_used_sum }}
还剩{{
developer_used_info.all_usable_number - developer_used_info.flyapp_used_sum - developer_used_info.other_used_sum
}} 可用
<el-popover
placement="top-start"
trigger="hover"
width="200">
<div>
<el-link :underline="false">全部设备总数 {{ developer_used_info.all_usable_number }}</el-link>
<el-link :underline="false">平台总使用设备数 {{ developer_used_info.all_use_number }}</el-link>
<el-link :underline="false">其他设备数 {{ developer_used_info.other_used_sum }}</el-link>
</div>
<el-link slot="reference" :underline="false">正常设备总量{{ developer_used_info.used_sign_number }}
已使用平台{{ developer_used_info.used_number }} 其他{{ developer_used_info.can_other_used }}
</el-link>
</el-popover>
<el-popover
placement="top-start"
trigger="hover"
width="230">
<div>
<el-link :underline="false">最大使用设备总数 {{ developer_used_info.may_sign_number }}</el-link>
<el-link :underline="false">将可能使用设备数
{{ developer_used_info.may_sign_number - developer_used_info.can_sign_number }}
</el-link>
<el-link :underline="false">当前可签名设备数 {{ developer_used_info.can_sign_number }}</el-link>
</div>
<el-link slot="reference" :underline="false">
还剩{{ developer_used_info.can_sign_number }} 可用
</el-link>
</el-popover>
<el-progress
:color="developer_usedColor"
:percentage="percentage"
@ -1326,7 +1349,16 @@ export default {
placeholder: "",
pagination: {"currentPage": 1, "total": 0, "pagesize": 10},
billpagination: {"currentPage": 1, "total": 0, "pagesize": 10},
developer_used_info: {"all_usable_number": 0, "other_used_sum": 0, "all_use_number": 0},
developer_used_info: {
'all_usable_number': 0,
'all_use_number': 0,
'other_used_sum': 0,
'flyapp_used_sum': 0,
'can_sign_number': 0,
'may_sign_number': 0,
'used_sign_number': 0,
'max_total': 0
},
percentage: 0,
apple_auth_list: [],
apple_auth_type: 0,
@ -1924,8 +1956,9 @@ export default {
this.status_choices = data.status_choices;
if (data.use_num) {
this.developer_used_info = data.use_num;
if (this.developer_used_info.all_usable_number !== 0) {
let p = parseInt((this.developer_used_info.flyapp_used_sum + this.developer_used_info.other_used_sum) * 100 / this.developer_used_info.all_usable_number);
let all_usable_number = this.developer_used_info.used_sign_number + this.developer_used_info.can_sign_number;
if (all_usable_number !== 0) {
let p = parseInt((all_usable_number - this.developer_used_info.can_sign_number) * 100 / all_usable_number);
if (p < 0 || p >= 100) {
p = 100
}

@ -119,30 +119,48 @@ def usable_number(developer_obj):
return d_count if d_count > u_count else u_count
def get_use_number(developer_obj):
return DeveloperDevicesID.objects.filter(developerid=developer_obj).values('udid').distinct().count()
def get_developer_devices(developer_obj_lists):
other_used_sum = 0
flyapp_used_sum = 0
max_total = 0
for dev_obj in developer_obj_lists.filter(status__in=Config.DEVELOPER_USE_STATUS):
developer_obj_lists = developer_obj_lists.filter(status__in=Config.DEVELOPER_USE_STATUS).all()
result_info = []
for dev_obj in developer_obj_lists:
other_used, flyapp_used, _ = get_developer_udided(dev_obj)
other_used_sum += other_used
flyapp_used_sum += flyapp_used
max_total += 100
use_number_obj_list = developer_obj_lists.filter(status__in=Config.DEVELOPER_USE_STATUS)
all_use_number = 0
all_usable_number = 0
for use_number_obj in use_number_obj_list:
all_usable_number += usable_number(use_number_obj)
all_use_number += DeveloperDevicesID.objects.filter(developerid=use_number_obj).values(
'udid').distinct().count()
result_info.append({
'other_used': other_used,
'flyapp_used': flyapp_used,
'usable_number': usable_number(dev_obj),
'use_number': get_use_number(dev_obj),
'status': dev_obj.status
})
use_num = {
"all_usable_number": all_usable_number,
"all_use_number": all_use_number,
"other_used_sum": other_used_sum,
"flyapp_used_sum": flyapp_used_sum,
"max_total": max_total
"all_usable_number": 0, # 可用的设备数
"all_use_number": 0, # 已经使用的设备数 【通过设备ID】
"other_used_sum": 0, # 开发者已经使用,但是平台未使用设备数
"flyapp_used_sum": 0, # 平台已经使用的设备数【通过设备安装详情】
"can_sign_number": 0, # 可以被用来签名数【状态为1】
"used_sign_number": 0, # 已被用来签名数【状态为1】
"may_sign_number": 0, # 可以被用来签名数
"can_other_used": 0, # 开发者已经使用,但是平台未使用设备数【状态为1】
"used_number": 0, # 可用的设备数【状态为1】
"max_total": 100 * len(result_info)
}
for info in result_info:
use_num['other_used_sum'] += info['other_used']
use_num['flyapp_used_sum'] += info['flyapp_used']
use_num['all_usable_number'] += info['usable_number']
use_num['all_use_number'] += info['use_number']
if info['status'] in Config.DEVELOPER_SIGN_STATUS:
use_num['can_sign_number'] += (info['usable_number'] - info['flyapp_used'] - info['other_used'])
use_num['used_sign_number'] += info['usable_number']
use_num['can_other_used'] += info['other_used']
use_num['used_number'] += info['use_number']
use_num['may_sign_number'] += (info['usable_number'] - info['flyapp_used'] - info['other_used'])
return use_num

@ -6,7 +6,7 @@ from rest_framework import serializers
from common.base.baseutils import AppleDeveloperUid, get_choices_dict
from common.core.sysconfig import Config
from xsign import models
from xsign.utils.modelutils import get_developer_udided
from xsign.utils.modelutils import get_developer_udided, get_use_number
logger = logging.getLogger(__name__)
@ -81,7 +81,7 @@ class DeveloperSerializer(serializers.ModelSerializer):
'udid').distinct().count()
def get_use_number(self, obj):
return models.DeveloperDevicesID.objects.filter(developerid=obj).values('udid').distinct().count()
return get_use_number(obj)
def get_app_used_count(self, obj):
return models.DeveloperAppID.objects.filter(developerid=obj).count()

Loading…
Cancel
Save