diff --git a/fir_client/src/components/user/FirSuperSignBase.vue b/fir_client/src/components/user/FirSuperSignBase.vue index 76771bc..22ddc5c 100644 --- a/fir_client/src/components/user/FirSuperSignBase.vue +++ b/fir_client/src/components/user/FirSuperSignBase.vue @@ -698,10 +698,12 @@ label="设备状态" width="110"> @@ -1120,7 +1122,11 @@ export default { this.bill_percent = 100; } } else { - this.bill_percent = Number(this.balance_info.used_balance * 100 / this.balance_info.all_balance); + if(this.balance_info.all_balance - this.balance_info.used_balance < 0){ + this.bill_percent = 100; + }else { + this.bill_percent = Number(this.balance_info.used_balance * 100 / this.balance_info.all_balance); + } } } } diff --git a/fir_ser/api/admin.py b/fir_ser/api/admin.py index 5bdf7f4..ea8c4cd 100644 --- a/fir_ser/api/admin.py +++ b/fir_ser/api/admin.py @@ -20,3 +20,5 @@ admin.site.register(DomainCnameInfo) admin.site.register(UserDomainInfo) admin.site.register(UserAdDisplayInfo) admin.site.register(IosDeveloperPublicPoolBill) +admin.site.register(AppReportInfo) +admin.site.register(RemoteClientInfo) diff --git a/fir_ser/api/migrations/0025_delete_devicequeue.py b/fir_ser/api/migrations/0025_delete_devicequeue.py new file mode 100644 index 0000000..5b64b26 --- /dev/null +++ b/fir_ser/api/migrations/0025_delete_devicequeue.py @@ -0,0 +1,15 @@ +# Generated by Django 3.2.3 on 2021-11-16 21:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ('api', '0024_auto_20211108_1755'), + ] + + operations = [ + migrations.DeleteModel( + name='DeviceQueue', + ), + ] diff --git a/fir_ser/api/models.py b/fir_ser/api/models.py index 4f0a1a5..1d3a35a 100644 --- a/fir_ser/api/models.py +++ b/fir_ser/api/models.py @@ -599,10 +599,3 @@ class AppReportInfo(models.Model): def __str__(self): return "%s-%s" % (self.app_name, self.report_reason) - - -class DeviceQueue(models.Model): - app_id = models.ForeignKey(to='Apps', on_delete=models.CASCADE, verbose_name="应用id") - udid = models.CharField(max_length=64, verbose_name="udid唯一标识", db_index=True) - developerid = models.ForeignKey(to="AppIOSDeveloperInfo", on_delete=models.CASCADE, verbose_name="所使用苹果开发者账户") - created_time = models.DateTimeField(auto_now_add=True, verbose_name="访问时间") diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index fc853f2..c752dce 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -19,7 +19,8 @@ from api.models import APPSuperSignUsedInfo, AppUDID, AppIOSDeveloperInfo, AppRe from api.utils.app.iossignapi import ResignApp, AppDeveloperApiV2 from api.utils.baseutils import file_format_path, delete_app_profile_file, get_profile_full_path, format_apple_date, \ get_format_time, make_app_uuid, make_from_user_uuid -from api.utils.modelutils import get_ios_developer_public_num, check_ipa_is_latest_sign +from api.utils.modelutils import get_ios_developer_public_num, check_ipa_is_latest_sign, \ + get_developer_can_used_from_public_sign from api.utils.response import BaseResponse from api.utils.serializer import BillAppInfoSerializer, BillDeveloperInfoSerializer from api.utils.storage.caches import del_cache_response_by_short, send_msg_over_limit, check_app_permission, \ @@ -264,7 +265,8 @@ def get_developer_user_by_app_udid(user_obj, udid): else: for developer_obj in AppIOSDeveloperInfo.objects.filter(user_id=user_obj, is_actived=True, certid__isnull=False).order_by("created_time"): - if get_developer_udided(developer_obj)[1] < developer_obj.usable_number: + if get_developer_udided(developer_obj)[1] + get_developer_can_used_from_public_sign( + user_obj) < developer_obj.usable_number: return developer_obj, False return None, None return developer_obj, True diff --git a/fir_ser/api/utils/modelutils.py b/fir_ser/api/utils/modelutils.py index e912640..1d8b935 100644 --- a/fir_ser/api/utils/modelutils.py +++ b/fir_ser/api/utils/modelutils.py @@ -153,6 +153,21 @@ def get_user_public_used_sign_num(user_obj): return number if number else 0 +def get_developer_can_used_from_public_sign(user_obj): + o_number_info = IosDeveloperPublicPoolBill.objects.filter(to_user_id__isnull=False, user_id=user_obj).values( + 'number').aggregate(number=Sum('number')) + o_number = o_number_info.get("number", 0) + + u_number_info = IosDeveloperPublicPoolBill.objects.filter( + user_id_id__in=IosDeveloperPublicPoolBill.objects.filter(user_id=user_obj).values('to_user_id_id')).values( + 'number', + 'udid_sync_info_id').annotate( + counts=Count('udid_sync_info_id')).aggregate(number=Sum('number')) + u_number = u_number_info.get("number", 0) + + return o_number - u_number + + def check_super_sign_permission(user_obj): if not user_obj.supersign_active: return False