优化代码

qrnn
youngS 3 years ago
parent d550d20998
commit 8bf925e9df
  1. 16
      fir_client/src/components/user/FirSuperSignBase.vue
  2. 2
      fir_ser/api/admin.py
  3. 15
      fir_ser/api/migrations/0025_delete_devicequeue.py
  4. 7
      fir_ser/api/models.py
  5. 6
      fir_ser/api/utils/app/supersignutils.py
  6. 15
      fir_ser/api/utils/modelutils.py

@ -698,10 +698,12 @@
label="设备状态"
width="110">
<template slot-scope="scope">
<el-tag v-if="!scope.row.udid_sync_info_id" type="info">已经释放</el-tag>
<el-tag v-else>
使用中
</el-tag>
<div v-if="scope.row.udid_sync_info_id!==null">
<el-tag v-if="!scope.row.udid_sync_info_id" type="info">已经释放</el-tag>
<el-tag v-else>
使用中
</el-tag>
</div>
</template>
</el-table-column>
@ -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);
}
}
}
}

@ -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)

@ -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',
),
]

@ -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="访问时间")

@ -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

@ -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

Loading…
Cancel
Save