From eed0f5194cae7ed688629182190794f9cdc6095e Mon Sep 17 00:00:00 2001 From: isummer Date: Sat, 12 Nov 2022 10:42:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8B=B9=E6=9E=9C=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=B1=BB=E5=9E=8B=E5=8C=BA=E5=88=86=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=8B=B9=E6=9E=9C=E8=AE=BE=E5=A4=87=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E9=87=8F=E5=8F=8A=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/user/FirSuperSignBase.vue | 34 +++++++++++++++---- fir_ser/common/constants.py | 12 +++++++ .../0004_udidsyncdeveloper_device_class.py | 20 +++++++++++ fir_ser/xsign/models.py | 8 ++++- fir_ser/xsign/utils/modelutils.py | 17 ++++++---- fir_ser/xsign/utils/serializer.py | 7 +++- fir_ser/xsign/views/supersign.py | 10 ++++++ 7 files changed, 93 insertions(+), 15 deletions(-) create mode 100644 fir_ser/xsign/migrations/0004_udidsyncdeveloper_device_class.py diff --git a/fir_client/src/components/user/FirSuperSignBase.vue b/fir_client/src/components/user/FirSuperSignBase.vue index 398418b..148c7b2 100644 --- a/fir_client/src/components/user/FirSuperSignBase.vue +++ b/fir_client/src/components/user/FirSuperSignBase.vue @@ -521,9 +521,10 @@ {{ developer_used_info.may_sign_number - developer_used_info.can_sign_number }} 当前可签名设备数: {{ developer_used_info.can_sign_number }} + 当前非苹果手机设备数: {{ developer_used_info.device_class_count }} - 还剩:{{ developer_used_info.can_sign_number }} 可用 + 还剩:{{ developer_used_info.can_sign_number + developer_used_info.device_class_count }} 可用 开发者账户ID: {{ scope.row.issuer_id }} -

开发者账户已使用设备数: {{ scope.row.developer_used_number }}

+

开发者账户已使用苹果手机设备数: {{ scope.row.developer_used_number }}

+

开发者账户已使用非苹果手机设备数: {{ scope.row.developer_other_device_used_number }} + 可忽略该设备数 +

开发者账户可用设备数: {{ 100 - scope.row.developer_used_number }}

由于您设置可用设备数: {{ 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"/> - + + style="width: 110px;margin-right: 5px" @change="handleCurrentChange(1)"> + + + 搜索 @@ -936,7 +945,7 @@ align="center" label="设备版本" prop="version" - width="200"> + width="180"> + + 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 diff --git a/fir_ser/xsign/utils/serializer.py b/fir_ser/xsign/utils/serializer.py index 3ff3351..25d015c 100644 --- a/fir_ser/xsign/utils/serializer.py +++ b/fir_ser/xsign/utils/serializer.py @@ -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] diff --git a/fir_ser/xsign/views/supersign.py b/fir_ser/xsign/views/supersign.py index 40eb72e..1b767d3 100644 --- a/fir_ser/xsign/views/supersign.py +++ b/fir_ser/xsign/views/supersign.py @@ -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)