publicsignpoll
youngS 3 years ago
parent abd2db398d
commit 674bf66827
  1. 2
      fir_ser/admin/views/supersign.py
  2. 5
      fir_ser/api/migrations/0015_iosdeveloperpublicpoolbill_remoteclientinfo.py
  3. 19
      fir_ser/api/migrations/0016_alter_appudid_udid.py
  4. 5
      fir_ser/api/models.py
  5. 12
      fir_ser/api/tasks.py
  6. 95
      fir_ser/api/utils/app/supersignutils.py
  7. 6
      fir_ser/api/utils/serializer.py
  8. 4
      fir_ser/api/utils/storage/caches.py
  9. 2
      fir_ser/api/views/supersign.py

@ -81,7 +81,7 @@ class DevicesInfoView(APIView):
sort = request.query_params.get("sort", "-created_time") sort = request.query_params.get("sort", "-created_time")
page_obj = AppsPageNumber() page_obj = AppsPageNumber()
if 'udid' in filter_data: if 'udid' in filter_data:
filter_data["udid__udid"] = filter_data['udid'] filter_data["udid__udid__udid"] = filter_data['udid']
del filter_data['udid'] del filter_data['udid']
if 'name' in filter_data: if 'name' in filter_data:

@ -1,4 +1,4 @@
# Generated by Django 3.2.3 on 2021-10-29 18:59 # Generated by Django 3.2.3 on 2021-10-30 10:57
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
@ -43,6 +43,9 @@ class Migration(migrations.Migration):
('to_user_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, ('to_user_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
related_name='to_user_id', to=settings.AUTH_USER_MODEL, related_name='to_user_id', to=settings.AUTH_USER_MODEL,
verbose_name='用户ID')), verbose_name='用户ID')),
('udid_sync_info',
models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL,
to='api.udidsyncdeveloper', verbose_name='关联同步设备信息')),
('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='org_user_id', ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='org_user_id',
to=settings.AUTH_USER_MODEL, verbose_name='用户ID')), to=settings.AUTH_USER_MODEL, verbose_name='用户ID')),
], ],

@ -0,0 +1,19 @@
# Generated by Django 3.2.3 on 2021-10-30 11:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0015_iosdeveloperpublicpoolbill_remoteclientinfo'),
]
operations = [
migrations.AlterField(
model_name='appudid',
name='udid',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.udidsyncdeveloper',
verbose_name='udid唯一标识'),
),
]

@ -237,7 +237,8 @@ class AppStorage(models.Model):
class AppUDID(models.Model): class AppUDID(models.Model):
app_id = models.ForeignKey(to="Apps", on_delete=models.CASCADE, verbose_name="属于哪个APP") app_id = models.ForeignKey(to="Apps", on_delete=models.CASCADE, verbose_name="属于哪个APP")
udid = models.CharField(max_length=64, verbose_name="udid唯一标识", db_index=True) # udid = models.CharField(max_length=64, verbose_name="udid唯一标识", db_index=True)
udid = models.ForeignKey(to="UDIDsyncDeveloper", verbose_name="udid唯一标识", on_delete=models.CASCADE)
product = models.CharField(max_length=64, verbose_name="产品", blank=True, null=True, ) product = models.CharField(max_length=64, verbose_name="产品", blank=True, null=True, )
serial = models.CharField(max_length=64, verbose_name="序列号", blank=True, null=True, ) serial = models.CharField(max_length=64, verbose_name="序列号", blank=True, null=True, )
version = models.CharField(max_length=64, verbose_name="型号", blank=True, null=True, ) version = models.CharField(max_length=64, verbose_name="型号", blank=True, null=True, )
@ -535,7 +536,7 @@ class IosDeveloperPublicPoolBill(models.Model):
app_info = models.JSONField(max_length=256, verbose_name="属于哪个APP", null=True, blank=True) 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) 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) 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="关联同步设备信息", udid_sync_info = models.ForeignKey(to="UDIDsyncDeveloper", on_delete=models.SET_NULL, verbose_name="关联同步设备信息",
null=True, blank=True) null=True, blank=True)
# app_id = models.ForeignKey(to="Apps", on_delete=models.CASCADE, verbose_name="属于哪个APP",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) # udid = models.ForeignKey(to="AppUDID", on_delete=models.CASCADE, verbose_name="所消耗的udid",null=True,blank=True)

@ -11,7 +11,7 @@ from api.utils.mp.wechat import sync_wx_access_token
from api.utils.storage.storage import get_local_storage from api.utils.storage.storage import get_local_storage
from api.models import Apps from api.models import Apps
from api.utils.app.supersignutils import IosUtils, resign_by_app_id from api.utils.app.supersignutils import IosUtils, resign_by_app_id, get_ios_developer_public_num
from api.utils.crontab.ctasks import sync_download_times, auto_clean_upload_tmp_file, auto_delete_ios_mobile_tmp_file, \ from api.utils.crontab.ctasks import sync_download_times, auto_clean_upload_tmp_file, auto_delete_ios_mobile_tmp_file, \
auto_check_ios_developer_active auto_check_ios_developer_active
from api.utils.geetest.geetest_utils import check_bypass_status from api.utils.geetest.geetest_utils import check_bypass_status
@ -23,9 +23,13 @@ from fir_ser.settings import LOGIN, CHANGER, REGISTER
@shared_task @shared_task
def run_sign_task(format_udid_info, short, client_ip): def run_sign_task(format_udid_info, short, client_ip):
app_info = Apps.objects.filter(short=short).first() app_obj = Apps.objects.filter(short=short).first()
with cache.lock("%s_%s_%s" % ('task_sign', app_info.app_id, format_udid_info.get('udid')), timeout=60 * 10): # with cache.lock("%s_%s_%s" % ('task_sign', app_obj.app_id, format_udid_info.get('udid')), timeout=60 * 10):
ios_obj = IosUtils(format_udid_info, app_info.user_id, app_info) ios_obj = IosUtils(format_udid_info, app_obj.user_id, app_obj)
if ios_obj.developer_obj is None:
return '签名余额不足'
with cache.lock("%s_%s_%s" % ('run_sign_task', app_obj.app_id, ios_obj.developer_obj.issuer_id), timeout=60 * 10):
ios_obj.get_developer_auth()
status, msg = ios_obj.sign(client_ip) status, msg = ios_obj.sign(client_ip)
if not status: if not status:
code = msg.get("code", -1) code = msg.get("code", -1)

@ -213,7 +213,7 @@ def get_ios_developer_public_num(user_obj):
def get_developer_user_by_app_udid(user_obj, udid): def get_developer_user_by_app_udid(user_obj, udid):
use_device_obj = APPSuperSignUsedInfo.objects.filter(udid__udid=udid, use_device_obj = APPSuperSignUsedInfo.objects.filter(udid__udid__udid=udid,
user_id=user_obj, developerid__is_actived=True, user_id=user_obj, developerid__is_actived=True,
developerid__certid__isnull=False).first() developerid__certid__isnull=False).first()
# 只要账户下面存在udid,就可以使用该苹果开发者账户,避免多个开发者账户下面出现同一个udid # 只要账户下面存在udid,就可以使用该苹果开发者账户,避免多个开发者账户下面出现同一个udid
@ -256,12 +256,13 @@ class IosUtils(object):
self.developer_obj = None self.developer_obj = None
self.auth = None self.auth = None
self.udid_info = udid_info self.udid_info = udid_info
self.udid = udid_info.get('udid')
self.app_obj = app_obj self.app_obj = app_obj
self.user_obj = user_obj self.user_obj = user_obj
self.get_developer_auth() self.get_developer_auth()
def get_developer_auth(self): def get_developer_auth(self):
self.developer_obj = self.get_developer_user_by_app_udid() self.developer_obj = get_developer_obj_by_others(self.user_obj, self.udid)
if self.developer_obj: if self.developer_obj:
self.auth = get_auth_form_developer(self.developer_obj) self.auth = get_auth_form_developer(self.developer_obj)
else: else:
@ -275,9 +276,6 @@ class IosUtils(object):
else: else:
logger.error(f"user {self.user_obj} send msg failed. over limit") logger.error(f"user {self.user_obj} send msg failed. over limit")
def get_developer_user_by_app_udid(self):
return get_developer_obj_by_others(self.user_obj, self.udid_info.get('udid'))
# def download_profile(self, developer_app_id, device_id_list): # def download_profile(self, developer_app_id, device_id_list):
# return get_api_obj(self.auth).get_profile(self.app_obj, self.udid_info, # return get_api_obj(self.auth).get_profile(self.app_obj, self.udid_info,
# self.get_profile_full_path(), # self.get_profile_full_path(),
@ -428,7 +426,8 @@ class IosUtils(object):
return storage_obj.upload_file(os.path.join(MEDIA_ROOT, random_file_name + ".ipa")) return storage_obj.upload_file(os.path.join(MEDIA_ROOT, random_file_name + ".ipa"))
def update_developer_used_data(self, client_ip): def update_developer_used_data(self, client_ip):
udid_obj = AppUDID.objects.filter(app_id=self.app_obj, udid=self.udid_info.get('udid')).first() udid_obj = AppUDID.objects.filter(app_id=self.app_obj, udid__udid=self.udid,
udid__developerid=self.developer_obj).first()
udid_obj.is_download = True udid_obj.is_download = True
udid_obj.save(update_fields=['is_download']) udid_obj.save(update_fields=['is_download'])
APPSuperSignUsedInfo.objects.update_or_create(app_id=self.app_obj, APPSuperSignUsedInfo.objects.update_or_create(app_id=self.app_obj,
@ -436,7 +435,7 @@ class IosUtils(object):
developerid=self.developer_obj, developerid=self.developer_obj,
udid=udid_obj) udid=udid_obj)
udid_sync_info = UDIDsyncDeveloper.objects.filter(developerid=self.developer_obj, udid_sync_info = UDIDsyncDeveloper.objects.filter(developerid=self.developer_obj,
uuid=self.udid_info.get('udid')).first() udid=self.udid).first()
IosDeveloperPublicPoolBill.objects.update_or_create(user_id=self.user_obj, IosDeveloperPublicPoolBill.objects.update_or_create(user_id=self.user_obj,
app_info=BillAppInfoSerializer(self.app_obj).data, app_info=BillAppInfoSerializer(self.app_obj).data,
developer_info=BillDeveloperInfoSerializer( developer_info=BillDeveloperInfoSerializer(
@ -455,7 +454,8 @@ class IosUtils(object):
"binary_file": random_file_name "binary_file": random_file_name
} }
# 更新已经完成签名状态,设备消耗记录,和开发者已消耗数量 # 更新已经完成签名状态,设备消耗记录,和开发者已消耗数量
AppUDID.objects.filter(app_id=app_obj, udid=udid).update(**newdata) udid_obj = UDIDsyncDeveloper.objects.filter(developerid=developer_obj, udid=udid).first()
AppUDID.objects.filter(app_id=app_obj, udid=udid_obj).update(**newdata)
del_cache_response_by_short(app_obj.app_id, udid=udid) del_cache_response_by_short(app_obj.app_id, udid=udid)
return True return True
@ -501,6 +501,7 @@ class IosUtils(object):
def sign(self, client_ip, sign_try_attempts=3): def sign(self, client_ip, sign_try_attempts=3):
""" """
:param client_ip:
:param sign_try_attempts: :param sign_try_attempts:
:return: status, result :return: status, result
:des: 仅用于苹果设备发送设备udid签名使用 :des: 仅用于苹果设备发送设备udid签名使用
@ -519,18 +520,20 @@ class IosUtils(object):
return False, {'code': res.code, 'msg': res.msg} return False, {'code': res.code, 'msg': res.msg}
if not self.developer_obj: if not self.developer_obj:
msg = "udid %s app %s not exists apple developer" % (self.udid_info.get('udid'), self.app_obj) msg = "udid %s app %s not exists apple developer" % (self.udid, self.app_obj)
d_result['code'] = 1005 d_result['code'] = 1005
d_result['msg'] = msg d_result['msg'] = msg
logger.error(d_result) logger.error(d_result)
return False, d_result return False, d_result
app_udid_obj = AppUDID.objects.filter(app_id=self.app_obj, udid=self.udid_info.get('udid')).first()
app_udid_obj = AppUDID.objects.filter(app_id=self.app_obj, udid__udid=self.udid,
udid__developerid=self.developer_obj).first()
if app_udid_obj and app_udid_obj.is_download: if app_udid_obj and app_udid_obj.is_download:
if app_udid_obj.is_signed: if app_udid_obj.is_signed:
release_obj = AppReleaseInfo.objects.filter(app_id=self.app_obj, is_master=True).first() release_obj = AppReleaseInfo.objects.filter(app_id=self.app_obj, is_master=True).first()
for apptodev_obj in APPToDeveloper.objects.filter(app_id=self.app_obj).all(): for apptodev_obj in APPToDeveloper.objects.filter(app_id=self.app_obj).all():
if release_obj.release_id == apptodev_obj.release_file: if release_obj.release_id == apptodev_obj.release_file:
msg = "udid %s exists app_id %s" % (self.udid_info.get('udid'), self.app_obj) msg = "udid %s exists app_id %s" % (self.udid, self.app_obj)
d_result['msg'] = msg d_result['msg'] = msg
logger.info(d_result) logger.info(d_result)
return True, d_result return True, d_result
@ -539,10 +542,10 @@ class IosUtils(object):
timeout=60 * 10): timeout=60 * 10):
logger.info("start run_sign ...") logger.info("start run_sign ...")
return IosUtils.run_sign(self.user_obj, self.app_obj, self.developer_obj, 1, return IosUtils.run_sign(self.user_obj, self.app_obj, self.developer_obj, 1,
self.udid_info.get('udid'), time.time(), self.udid, time.time(),
None) None)
logger.info("udid %s not exists app_id %s ,need sign" % (self.udid_info.get('udid'), self.app_obj)) logger.info("udid %s not exists app_id %s ,need sign" % (self.udid, self.app_obj))
if consume_user_download_times_by_app_obj(self.app_obj): if consume_user_download_times_by_app_obj(self.app_obj):
d_result['code'] = 1009 d_result['code'] = 1009
@ -571,22 +574,26 @@ class IosUtils(object):
call_flag = False call_flag = False
count += 1 count += 1
if download_flag: if download_flag:
AppUDID.objects.update_or_create(app_id=self.app_obj, udid=self.udid_info.get('udid'), app_udid_obj = UDIDsyncDeveloper.objects.filter(developerid=self.developer_obj,
defaults=self.udid_info) udid=self.udid)
udid_info = self.udid_info
del udid_info['udid']
AppUDID.objects.update_or_create(app_id=self.app_obj, udid=app_udid_obj.first(),
defaults=udid_info)
if not result.get("did_exists", None): if not result.get("did_exists", None):
app_udid_obj = UDIDsyncDeveloper.objects.filter(developerid=self.developer_obj, app_udid_obj = app_udid_obj.filter(status=True).first()
udid=self.udid_info.get('udid'), status=True).first()
if not app_udid_obj: if not app_udid_obj:
appudid_obj = AppUDID.objects.filter(app_id=self.app_obj, udid=self.udid_info.get('udid')) appudid_obj = AppUDID.objects.filter(app_id=self.app_obj, udid__udid=self.udid,
udid__developerid=self.developer_obj)
device = appudid_obj.values("serial", device = appudid_obj.values("serial",
'product', 'product',
'udid', 'udid__udid',
'version').first() 'version').first()
if result.get("did", None): if result.get("did", None):
device['serial'] = result["did"] device['serial'] = result["did"]
device['status'] = True device['status'] = True
app_udid_obj, _ = UDIDsyncDeveloper.objects.update_or_create(developerid=self.developer_obj, app_udid_obj, _ = UDIDsyncDeveloper.objects.update_or_create(developerid=self.developer_obj,
udid=device['udid'], udid=device['udid__udid'],
defaults=device) defaults=device)
DeveloperDevicesID.objects.create(did=result["did"], udid=app_udid_obj, DeveloperDevicesID.objects.create(did=result["did"], udid=app_udid_obj,
developerid=self.developer_obj, developerid=self.developer_obj,
@ -607,7 +614,7 @@ class IosUtils(object):
with cache.lock("%s_%s_%s" % ('run_sign', self.app_obj.app_id, self.developer_obj.issuer_id), timeout=60 * 10): with cache.lock("%s_%s_%s" % ('run_sign', self.app_obj.app_id, self.developer_obj.issuer_id), timeout=60 * 10):
logger.info("start run_sign ...") logger.info("start run_sign ...")
return IosUtils.run_sign(self.user_obj, self.app_obj, self.developer_obj, download_flag, return IosUtils.run_sign(self.user_obj, self.app_obj, self.developer_obj, download_flag,
self.udid_info.get('udid'), start_time, self.udid, start_time,
result) result)
@staticmethod @staticmethod
@ -619,8 +626,12 @@ class IosUtils(object):
auth = get_auth_form_developer(developer_obj) auth = get_auth_form_developer(developer_obj)
# 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作 # 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作
udid_lists = list(APPSuperSignUsedInfo.objects.values_list("udid__udid").filter(developerid=developer_obj)) udid_lists = list(
APPSuperSignUsedInfo.objects.values_list("udid__udid__udid").filter(developerid=developer_obj))
IosUtils.do_disable_device(developer_obj, udid_lists, udid_obj, auth) IosUtils.do_disable_device(developer_obj, udid_lists, udid_obj, auth)
DeveloperDevicesID.objects.filter(udid__appudid=udid_obj, developerid=developer_obj,
app_id_id=app_id).delete()
udid_obj.delete()
# 通过开发者id判断 app_id 是否多个,否则删除profile 文件 # 通过开发者id判断 app_id 是否多个,否则删除profile 文件
if APPSuperSignUsedInfo.objects.filter(developerid=developer_obj, app_id_id=app_id).count() == 0: if APPSuperSignUsedInfo.objects.filter(developerid=developer_obj, app_id_id=app_id).count() == 0:
app_api_obj = get_api_obj(auth) app_api_obj = get_api_obj(auth)
@ -632,18 +643,12 @@ class IosUtils(object):
delete_app_to_dev_and_file(developer_obj, app_id) delete_app_to_dev_and_file(developer_obj, app_id)
delete_app_profile_file(developer_obj, app_obj) delete_app_profile_file(developer_obj, app_obj)
app_udid_obj = UDIDsyncDeveloper.objects.filter(developerid=developer_obj,
udid=udid_obj.udid).first()
DeveloperDevicesID.objects.filter(udid=app_udid_obj, developerid=developer_obj, app_id_id=app_id).delete()
@staticmethod @staticmethod
def do_disable_device(developer_obj, udid_lists, udid_obj, auth): def do_disable_device(developer_obj, udid_lists, udid_obj, auth):
if udid_lists.count((udid_obj.udid,)) == 1: if udid_lists.count((udid_obj.udid.udid,)) == 1:
app_api_obj = get_api_obj(auth) app_api_obj = get_api_obj(auth)
app_api_obj.set_device_status("disable", udid_obj.udid) app_api_obj.set_device_status("disable", udid_obj.udid.udid)
UDIDsyncDeveloper.objects.filter(udid=udid_obj.udid, developerid=developer_obj).update(status=False) UDIDsyncDeveloper.objects.filter(udid=udid_obj.udid.udid, developerid=developer_obj).update(status=False)
udid_obj.delete()
@staticmethod @staticmethod
def clean_udid_by_app_obj(app_obj, developer_obj): def clean_udid_by_app_obj(app_obj, developer_obj):
@ -651,16 +656,16 @@ class IosUtils(object):
auth = get_auth_form_developer(developer_obj) auth = get_auth_form_developer(developer_obj)
# 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作 # 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作
udid_lists = list(APPSuperSignUsedInfo.objects.values_list("udid__udid").filter(developerid=developer_obj)) udid_lists = list(
APPSuperSignUsedInfo.objects.values_list("udid__udid__udid").filter(developerid=developer_obj))
for SuperSignUsed_obj in APPSuperSignUsedInfo.objects.filter(app_id=app_obj, developerid=developer_obj): for SuperSignUsed_obj in APPSuperSignUsedInfo.objects.filter(app_id=app_obj, developerid=developer_obj):
udid_obj = SuperSignUsed_obj.udid udid_obj = SuperSignUsed_obj.udid
IosUtils.do_disable_device(developer_obj, udid_lists, udid_obj, auth) IosUtils.do_disable_device(developer_obj, udid_lists, udid_obj, auth)
SuperSignUsed_obj.delete() SuperSignUsed_obj.delete()
DeveloperDevicesID.objects.filter(udid__appudid=udid_obj, developerid=developer_obj,
app_udid_obj = UDIDsyncDeveloper.objects.filter(developerid=developer_obj, app_id=app_obj).delete()
udid=udid_obj.udid).first() udid_obj.delete()
DeveloperDevicesID.objects.filter(udid=app_udid_obj, developerid=developer_obj, app_id=app_obj).delete()
@staticmethod @staticmethod
def clean_app_by_user_obj(app_obj): def clean_app_by_user_obj(app_obj):
@ -833,11 +838,23 @@ class IosUtils(object):
if not create: if not create:
DeveloperDevicesID.objects.filter(udid=obj, developerid=developer_obj).update( DeveloperDevicesID.objects.filter(udid=obj, developerid=developer_obj).update(
**{'did': device_obj.id}) **{'did': device_obj.id})
AppUDID.objects.filter(udid__in=will_del_disabled_udid_list, AppUDID.objects.filter(udid__udid__in=will_del_disabled_udid_list,
app_id__developerdevicesid__udid__in=UDIDsyncDeveloper.objects.filter( app_id__developerdevicesid__udid__in=UDIDsyncDeveloper.objects.filter(
udid__in=will_del_disabled_udid_list)).delete() udid__in=will_del_disabled_udid_list)).delete()
developer_device_list = DeveloperDevicesID.objects.filter(udid__udid__in=will_del_disabled_udid_list,
developerid=developer_obj).all()
for developer_device_obj in developer_device_list:
app_obj = developer_device_obj.app_id
if APPSuperSignUsedInfo.objects.filter(developerid=developer_obj, app_id=app_obj).count() == 0:
app_api_obj = get_api_obj(auth)
app_api_obj.del_profile(app_obj.app_id)
app_api_obj2 = get_api_obj(auth)
app_api_obj2.del_app(app_obj.bundle_id, app_obj.app_id)
DeveloperAppID.objects.filter(developerid=developer_obj, app_id=app_obj).delete()
delete_app_to_dev_and_file(developer_obj, app_obj.pk)
delete_app_profile_file(developer_obj, app_obj)
developer_device_obj.delete()
UDIDsyncDeveloper.objects.filter(udid__in=will_del_udid_list, developerid=developer_obj).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 return status, result

@ -476,7 +476,7 @@ class SuperSignUsedSerializer(serializers.ModelSerializer):
other_uid = serializers.SerializerMethodField() other_uid = serializers.SerializerMethodField()
def get_device_udid(self, obj): def get_device_udid(self, obj):
return obj.udid.udid return obj.udid.udid.udid
def get_device_name(self, obj): def get_device_name(self, obj):
return obj.udid.product return obj.udid.product
@ -540,6 +540,7 @@ class DeviceUDIDSerializer(serializers.ModelSerializer):
bundle_name = serializers.SerializerMethodField() bundle_name = serializers.SerializerMethodField()
is_mine = serializers.SerializerMethodField() is_mine = serializers.SerializerMethodField()
other_uid = serializers.SerializerMethodField() other_uid = serializers.SerializerMethodField()
udid = serializers.SerializerMethodField()
def get_other_uid(self, obj): def get_other_uid(self, obj):
user_obj = self.context.get('user_obj') user_obj = self.context.get('user_obj')
@ -551,6 +552,9 @@ class DeviceUDIDSerializer(serializers.ModelSerializer):
if super_user_obj.developerid.user_id != obj.app_id.user_id: if super_user_obj.developerid.user_id != obj.app_id.user_id:
return obj.app_id.user_id.uid return obj.app_id.user_id.uid
def get_udid(self, obj):
return obj.udid.udid
def get_is_mine(self, obj): def get_is_mine(self, obj):
return self.context.get('mine') return self.context.get('mine')

@ -42,9 +42,9 @@ def get_download_url_by_cache(app_obj, filename, limit, isdownload=True, key='',
if app_obj.get('issupersign', None): if app_obj.get('issupersign', None):
download_url_type = 'mobileconifg' download_url_type = 'mobileconifg'
else: else:
appudid_obj = AppUDID.objects.filter(app_id_id=app_obj.get("pk"), udid=udid, is_signed=True).first() appudid_obj = AppUDID.objects.filter(app_id_id=app_obj.get("pk"), udid__udid=udid, is_signed=True).first()
if appudid_obj: if appudid_obj:
super_sign_obj = APPSuperSignUsedInfo.objects.filter(udid__udid=udid, super_sign_obj = APPSuperSignUsedInfo.objects.filter(udid__udid__udid=udid,
app_id_id=app_obj.get("pk")).first() app_id_id=app_obj.get("pk")).first()
if super_sign_obj and super_sign_obj.user_id.supersign_active: if super_sign_obj and super_sign_obj.user_id.supersign_active:
app_to_developer_obj = APPToDeveloper.objects.filter(app_id_id=app_obj.get("pk"), app_to_developer_obj = APPToDeveloper.objects.filter(app_id_id=app_obj.get("pk"),

@ -198,7 +198,7 @@ def base_super_sign_used_info(request):
if developer_id: if developer_id:
super_sign_used_objs = super_sign_used_objs.filter(developerid__issuer_id=developer_id) super_sign_used_objs = super_sign_used_objs.filter(developerid__issuer_id=developer_id)
if udid: if udid:
super_sign_used_objs = super_sign_used_objs.filter(udid__udid=udid) super_sign_used_objs = super_sign_used_objs.filter(udid__udid__udid=udid)
if bundle_id: if bundle_id:
super_sign_used_objs = super_sign_used_objs.filter(app_id__bundle_id=bundle_id) super_sign_used_objs = super_sign_used_objs.filter(app_id__bundle_id=bundle_id)
return super_sign_used_objs, mine return super_sign_used_objs, mine

Loading…
Cancel
Save