From abd2db398d4193e8743368fad6a8143918604f63 Mon Sep 17 00:00:00 2001 From: fxC Date: Fri, 29 Oct 2021 22:51:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/models.py | 2 ++ fir_ser/api/utils/app/supersignutils.py | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fir_ser/api/models.py b/fir_ser/api/models.py index 6528690..703a198 100644 --- a/fir_ser/api/models.py +++ b/fir_ser/api/models.py @@ -535,6 +535,8 @@ class IosDeveloperPublicPoolBill(models.Model): app_info = models.JSONField(max_length=256, verbose_name="属于哪个APP", null=True, blank=True) udid_info = models.JSONField(max_length=256, verbose_name="设备id信息", null=True, blank=True) developer_info = models.JSONField(max_length=256, verbose_name="开发者信息", null=True, blank=True) + udid_sync_info = models.ForeignKey(to="UDIDsyncDeveloper", on_delete=models.SET_NULL, validators="关联同步设备信息", + null=True, blank=True) # app_id = models.ForeignKey(to="Apps", on_delete=models.CASCADE, verbose_name="属于哪个APP",null=True,blank=True) # udid = models.ForeignKey(to="AppUDID", on_delete=models.CASCADE, verbose_name="所消耗的udid",null=True,blank=True) # developerid = models.ForeignKey(to="AppIOSDeveloperInfo", on_delete=models.CASCADE, verbose_name="所使用苹果开发者账户",null=True,blank=True) diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index 913ca3f..2012fb7 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -197,7 +197,9 @@ def err_callback(func, *args, **kwargs): def get_ios_developer_public_num(user_obj): add_number = IosDeveloperPublicPoolBill.objects.filter(to_user_id=user_obj, action__in=[1, 2]).aggregate( number=Sum('number')) - used_number = IosDeveloperPublicPoolBill.objects.filter(user_id=user_obj, action=0).aggregate(number=Sum('number')) + used_number = IosDeveloperPublicPoolBill.objects.filter(user_id=user_obj, action=0, + udid_sync_info__isnull=False).aggregate( + number=Sum('number')) if add_number: add_number = add_number.get("number", 0) if not add_number: @@ -433,12 +435,15 @@ class IosUtils(object): user_id=self.user_obj, developerid=self.developer_obj, udid=udid_obj) + udid_sync_info = UDIDsyncDeveloper.objects.filter(developerid=self.developer_obj, + uuid=self.udid_info.get('udid')).first() IosDeveloperPublicPoolBill.objects.update_or_create(user_id=self.user_obj, app_info=BillAppInfoSerializer(self.app_obj).data, developer_info=BillDeveloperInfoSerializer( self.developer_obj).data, udid_info=BillUdidInfoSerializer(udid_obj).data, action=0, - number=1) + number=1, udid_sync_info=udid_sync_info + ) @staticmethod def update_sign_data(user_obj, app_obj, developer_obj, random_file_name, release_obj, udid): @@ -831,7 +836,8 @@ class IosUtils(object): AppUDID.objects.filter(udid__in=will_del_disabled_udid_list, app_id__developerdevicesid__udid__in=UDIDsyncDeveloper.objects.filter( udid__in=will_del_disabled_udid_list)).delete() - UDIDsyncDeveloper.objects.filter(udid__in=will_del_udid_list).delete() - DeveloperDevicesID.objects.filter(udid__udid__in=will_del_disabled_udid_list).delete() + UDIDsyncDeveloper.objects.filter(udid__in=will_del_udid_list, developerid=developer_obj).delete() + DeveloperDevicesID.objects.filter(udid__udid__in=will_del_disabled_udid_list, + developerid=developer_obj).delete() return status, result