增加苹果设备类型区分,优化苹果设备注册量及展示

dependabot/npm_and_yarn/fir_admin/decode-uri-component-0.2.2
isummer 2 years ago
parent e0599585be
commit eed0f5194c
  1. 34
      fir_client/src/components/user/FirSuperSignBase.vue
  2. 12
      fir_ser/common/constants.py
  3. 20
      fir_ser/xsign/migrations/0004_udidsyncdeveloper_device_class.py
  4. 8
      fir_ser/xsign/models.py
  5. 17
      fir_ser/xsign/utils/modelutils.py
  6. 7
      fir_ser/xsign/utils/serializer.py
  7. 10
      fir_ser/xsign/views/supersign.py

@ -521,9 +521,10 @@
{{ 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>
<el-link :underline="false">当前非苹果手机设备数 {{ developer_used_info.device_class_count }}</el-link>
</div>
<el-link slot="reference" :underline="false">
还剩{{ developer_used_info.can_sign_number }} 可用
还剩{{ developer_used_info.can_sign_number + developer_used_info.device_class_count }} 可用
</el-link>
</el-popover>
<el-progress
@ -589,7 +590,10 @@
:underline="false">开发者账户ID: {{ scope.row.issuer_id }}
</el-link>
</el-tooltip>
<p>开发者账户已使用设备数: {{ scope.row.developer_used_number }}</p>
<p>开发者账户已使用苹果手机设备数: {{ scope.row.developer_used_number }}</p>
<p>开发者账户已使用非苹果手机设备数: {{ scope.row.developer_other_device_used_number }}
<el-tag size="mini" type="warning">可忽略该设备数</el-tag>
</p>
<p>开发者账户可用设备数: {{ 100 - scope.row.developer_used_number }}</p>
<p>由于您设置可用设备数: {{ scope.row.usable_number }} ,所以现在可用设备数: {{
scope.row.usable_number - scope.row.developer_used_number > 0
@ -873,17 +877,22 @@
v-model="udidsearch"
clearable
placeholder="输入UDID"
style="width: 30%;margin-right: 30px;margin-bottom: 10px"/>
style="width: 30%;margin-right: 5px;margin-bottom: 10px"/>
<el-input
v-model="appidseach"
clearable
placeholder="输入开发者用户ID"
style="width: 30%;margin-right: 30px;margin-bottom: 10px"/>
<el-select v-if="status_choices" v-model="devicestatus" clearable multiple
style="width: 30%;margin-right: 5px;margin-bottom: 10px"/>
<el-select v-model="devicestatus" clearable multiple
placeholder="设备状态"
style="width: 120px;margin-right: 30px" @change="handleCurrentChange(1)">
style="width: 110px;margin-right: 5px" @change="handleCurrentChange(1)">
<el-option v-for="item in device_status_choices" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
<el-select v-model="deviceclass" clearable multiple
placeholder="设备类型"
style="width: 110px;margin-right: 5px" @change="handleCurrentChange(1)">
<el-option v-for="item in device_class_choices" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
<el-button icon="el-icon-search" type="primary" @click="handleCurrentChange(1)">
搜索
</el-button>
@ -936,7 +945,7 @@
align="center"
label="设备版本"
prop="version"
width="200">
width="180">
</el-table-column>
<el-table-column
align="center"
@ -958,6 +967,12 @@
</el-tooltip>
</template>
</el-table-column>
<el-table-column
align="center"
label="设备类型"
prop="device_class"
width="80">
</el-table-column>
<el-table-column
:formatter="deviceformatter"
align="center"
@ -1843,6 +1858,7 @@ export default {
Bundleidsearch: "",
appidseach: "",
devicestatus: "",
deviceclass: "",
operatestatus: "",
operate_status_choices: [],
uidsearch: "",
@ -1928,6 +1944,7 @@ export default {
appletoapp_title: '',
status_choices: [],
device_status_choices: [],
device_class_choices: [],
read_only_mode: 'off',
developer_status_choice: [],
multipleSelection: [],
@ -2353,6 +2370,7 @@ export default {
"issuer_id": this.appidseach,
"act": "syncalldevice",
"devicestatus": this.devicestatus,
"deviceclass": this.deviceclass,
"udidsearch": this.udidsearch
}
});
@ -2524,6 +2542,7 @@ export default {
this.iosdevicerankFun({"methods": "GET", "data": data})
} else if (tabname === "iosudevices") {
data.devicestatus = JSON.stringify(this.devicestatus);
data.deviceclass = JSON.stringify(this.deviceclass);
this.iosudevicesFun("GET", data)
} else if (tabname === 'operatemsg') {
data.operate_status = this.operatestatus;
@ -2795,6 +2814,7 @@ export default {
this.developer_udevices_lists = data.data;
this.pagination.total = data.count;
this.device_status_choices = data.status_choices;
this.device_class_choices = data.device_class_choices;
} else {
this.refreshactiveFun()
}

@ -43,3 +43,15 @@ class SignStatus(object):
APP_REGISTRATION_COMPLETE = 2
PROFILE_DOWNLOAD_COMPLETE = 3
SIGNATURE_PACKAGE_COMPLETE = 4
class DeviceClass(object):
"""
苹果设备类型分为6类每类都有100设备数
"""
APPLE_WATCH = 'APPLE_WATCH'
IPAD = 'IPAD'
IPHONE = 'IPHONE'
IPOD = 'IPOD'
APPLE_TV = 'APPLE_TV'
MAC = 'MAC'

@ -0,0 +1,20 @@
# Generated by Django 4.0.8 on 2022-11-12 08:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('xsign', '0003_deviceabnormaludid_deviceblackudid'),
]
operations = [
migrations.AddField(
model_name='udidsyncdeveloper',
name='device_class',
field=models.CharField(
choices=[('APPLE_WATCH', 'APPLE_WATCH'), ('IPAD', 'IPAD'), ('IPHONE', 'IPHONE'), ('IPOD', 'IPOD'),
('APPLE_TV', 'APPLE_TV'), ('MAC', 'MAC')], default='IPHONE', max_length=16,
verbose_name='设备类型'),
),
]

@ -2,7 +2,7 @@ from django.db import models
from api.models import Apps, UserInfo
from common.base.daobase import AESCharField
from common.constants import DeviceStatus, AppleDeveloperStatus, SignStatus
from common.constants import DeviceStatus, AppleDeveloperStatus, SignStatus, DeviceClass
class AppIOSDeveloperInfo(models.Model):
@ -75,6 +75,12 @@ class UDIDsyncDeveloper(models.Model):
(DeviceStatus.PROCESSING, '处理中'), (DeviceStatus.INELIGIBLE, '不合格'))
status = models.CharField(choices=status_choices, verbose_name="设备状态", default=DeviceStatus.DISABLED, max_length=16)
device_class_choices = ((DeviceClass.APPLE_WATCH, 'APPLE_WATCH'), (DeviceClass.IPAD, 'IPAD'),
(DeviceClass.IPHONE, 'IPHONE'), (DeviceClass.IPOD, 'IPOD'),
(DeviceClass.APPLE_TV, 'APPLE_TV'), (DeviceClass.MAC, 'MAC'))
device_class = models.CharField(choices=device_class_choices, verbose_name="设备类型", default=DeviceClass.IPHONE,
max_length=16)
class Meta:
verbose_name = 'iOS开发平台同步设备信息'
verbose_name_plural = "iOS开发平台同步设备信息"

@ -11,7 +11,7 @@ from django.db.models import Count, Sum, Q
from api.models import AppReleaseInfo, UserInfo
from common.base.baseutils import is_valid_phone
from common.constants import SignStatus, AppleDeveloperStatus
from common.constants import SignStatus, AppleDeveloperStatus, DeviceClass
from common.core.sysconfig import Config, UserConfig
from xsign.models import APPSuperSignUsedInfo, UDIDsyncDeveloper, AppUDID, APPToDeveloper, AppIOSDeveloperInfo, \
IosDeveloperPublicPoolBill, IosDeveloperBill, DeveloperDevicesID, AppleDeveloperToAppUse, DeveloperAppID, \
@ -106,7 +106,8 @@ def update_or_create_developer_udid_info(device_obj, developer_obj):
"product": device_obj.name,
"udid": device_obj.udid,
"version": device_obj.model,
"status": device_obj.status
"status": device_obj.status,
"device_class": device_obj.deviceClass
}
return UDIDsyncDeveloper.objects.update_or_create(developerid=developer_obj, udid=device_obj.udid, defaults=device)
@ -117,7 +118,7 @@ def check_uid_has_relevant(user_uid, to_user_uid):
def usable_number(developer_obj):
d_count = UDIDsyncDeveloper.objects.filter(developerid=developer_obj).count()
d_count = UDIDsyncDeveloper.objects.filter(developerid=developer_obj, device_class=DeviceClass.IPHONE).count()
u_count = developer_obj.usable_number
return d_count if d_count > u_count else u_count
@ -131,13 +132,16 @@ def get_developer_devices(developer_obj_lists, user_obj):
result_info = []
for dev_obj in developer_obj_lists:
other_used, flyapp_used, _ = get_developer_udided(dev_obj)
device_class_count = UDIDsyncDeveloper.objects.filter(developerid=dev_obj).exclude(
device_class=DeviceClass.IPHONE).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,
'abnormal_register': dev_obj.abnormal_register
'abnormal_register': dev_obj.abnormal_register,
'device_class_count': device_class_count
})
use_num = {
@ -150,7 +154,8 @@ def get_developer_devices(developer_obj_lists, user_obj):
"may_sign_number": 0, # 可以被用来签名数
"can_other_used": 0, # 开发者已经使用,但是平台未使用设备数【状态为1】
"used_number": 0, # 可用的设备数【状态为1】
"max_total": 100 * len(result_info)
"max_total": 100 * len(result_info),
"device_class_count": 0 # 除了IPHONE其他设备状态
}
developer_status = Config.DEVELOPER_SIGN_STATUS
@ -169,7 +174,7 @@ def get_developer_devices(developer_obj_lists, user_obj):
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'])
use_num['device_class_count'] += info['device_class_count']
return use_num

@ -4,6 +4,7 @@ from django.db.models import Sum
from rest_framework import serializers
from common.base.baseutils import AppleDeveloperUid, get_choices_dict
from common.constants import DeviceClass
from common.core.sysconfig import Config
from xsign import models
from xsign.utils.modelutils import get_developer_udided, get_use_number
@ -18,6 +19,7 @@ class DeveloperSerializer(serializers.ModelSerializer):
exclude = ["id", "user_id", "p8key"]
developer_used_number = serializers.SerializerMethodField()
developer_other_device_used_number = serializers.SerializerMethodField()
developer_used_other_number = serializers.SerializerMethodField()
use_number = serializers.SerializerMethodField()
app_used_count = serializers.SerializerMethodField()
@ -46,7 +48,10 @@ class DeveloperSerializer(serializers.ModelSerializer):
return 0
def get_developer_used_number(self, obj):
return models.UDIDsyncDeveloper.objects.filter(developerid=obj).count()
return models.UDIDsyncDeveloper.objects.filter(developerid=obj, device_class=DeviceClass.IPHONE).count()
def get_developer_other_device_used_number(self, obj):
return models.UDIDsyncDeveloper.objects.filter(developerid=obj).exclude(device_class=DeviceClass.IPHONE).count()
def get_developer_used_other_number(self, obj):
return get_developer_udided(obj)[0]

@ -507,6 +507,7 @@ class DeveloperDeviceView(APIView):
udid = request.query_params.get("udid", None)
issuer_id = request.query_params.get("issuer_id", None)
device_status = request.query_params.get("devicestatus", None)
device_class = request.query_params.get("deviceclass", None)
super_sign_used_objs = UDIDsyncDeveloper.objects.filter(developerid__user_id=request.user, )
if device_status:
try:
@ -515,6 +516,14 @@ class DeveloperDeviceView(APIView):
super_sign_used_objs = super_sign_used_objs.filter(status__in=device_status)
except Exception as e:
logger.warning(f'device status json load failed. Exception:{e} .{device_status}')
if device_class:
try:
device_class = json.loads(device_class)
if device_class is not None and isinstance(device_class, list) and device_class:
super_sign_used_objs = super_sign_used_objs.filter(device_class__in=device_class)
except Exception as e:
logger.warning(f'device_class json load failed. Exception:{e} .{device_class}')
if issuer_id:
super_sign_used_objs = super_sign_used_objs.filter(developerid__issuer_id=issuer_id)
if udid:
@ -526,6 +535,7 @@ class DeveloperDeviceView(APIView):
app_serializer = DeveloperDeviceSerializer(app_page_serializer, many=True)
res.data = app_serializer.data
res.status_choices = get_choices_dict(UDIDsyncDeveloper.status_choices)
res.device_class_choices = get_choices_dict(UDIDsyncDeveloper.device_class_choices)
res.count = super_sign_used_objs.count()
return Response(res.dict)

Loading…
Cancel
Save