|
|
@ -318,12 +318,14 @@ class IosUtils(object): |
|
|
|
developerid=developer_obj).values_list('did') |
|
|
|
developerid=developer_obj).values_list('did') |
|
|
|
device_id_lists = [did[0] for did in device_id_list] |
|
|
|
device_id_lists = [did[0] for did in device_id_list] |
|
|
|
developer_app_id = None |
|
|
|
developer_app_id = None |
|
|
|
|
|
|
|
profile_id = None |
|
|
|
add_did_flag = False |
|
|
|
add_did_flag = False |
|
|
|
sync_device_obj = None |
|
|
|
sync_device_obj = None |
|
|
|
developer_app_id_obj = DeveloperAppID.objects.filter(developerid=developer_obj, |
|
|
|
developer_app_id_obj = DeveloperAppID.objects.filter(developerid=developer_obj, |
|
|
|
app_id=app_obj).first() |
|
|
|
app_id=app_obj).first() |
|
|
|
if developer_app_id_obj: |
|
|
|
if developer_app_id_obj: |
|
|
|
developer_app_id = developer_app_id_obj.aid |
|
|
|
developer_app_id = developer_app_id_obj.aid |
|
|
|
|
|
|
|
profile_id = developer_app_id_obj.profile_id |
|
|
|
if udid_info: |
|
|
|
if udid_info: |
|
|
|
sync_device_obj = UDIDsyncDeveloper.objects.filter(udid=udid_info.get('udid'), |
|
|
|
sync_device_obj = UDIDsyncDeveloper.objects.filter(udid=udid_info.get('udid'), |
|
|
|
developerid=developer_obj, status=True).first() |
|
|
|
developerid=developer_obj, status=True).first() |
|
|
@ -339,9 +341,11 @@ class IosUtils(object): |
|
|
|
|
|
|
|
|
|
|
|
status, result = get_api_obj(auth).get_profile(app_obj, udid_info, |
|
|
|
status, result = get_api_obj(auth).get_profile(app_obj, udid_info, |
|
|
|
get_profile_full_path(developer_obj, app_obj), |
|
|
|
get_profile_full_path(developer_obj, app_obj), |
|
|
|
auth, developer_app_id, device_id_lists, |
|
|
|
auth, developer_app_id, device_id_lists, profile_id, |
|
|
|
err_callback(IosUtils.get_device_from_developer, |
|
|
|
err_callback(IosUtils.get_device_from_developer, |
|
|
|
developer_obj)) |
|
|
|
developer_obj), |
|
|
|
|
|
|
|
err_callback(IosUtils.clean_super_sign_things_by_app_obj, |
|
|
|
|
|
|
|
app_obj, developer_obj)) |
|
|
|
if add_did_flag and sync_device_obj: |
|
|
|
if add_did_flag and sync_device_obj: |
|
|
|
result['did'] = sync_device_obj.serial |
|
|
|
result['did'] = sync_device_obj.serial |
|
|
|
result['did_exists'] = True |
|
|
|
result['did_exists'] = True |
|
|
@ -363,6 +367,9 @@ class IosUtils(object): |
|
|
|
|
|
|
|
|
|
|
|
if not developer_app_id and result.get("aid", None): |
|
|
|
if not developer_app_id and result.get("aid", None): |
|
|
|
DeveloperAppID.objects.create(aid=result["aid"], developerid=developer_obj, app_id=app_obj) |
|
|
|
DeveloperAppID.objects.create(aid=result["aid"], developerid=developer_obj, app_id=app_obj) |
|
|
|
|
|
|
|
if result.get("profile_id", None): |
|
|
|
|
|
|
|
DeveloperAppID.objects.filter(developerid=developer_obj, app_id=app_obj).update( |
|
|
|
|
|
|
|
profile_id=result.get("profile_id", None)) |
|
|
|
|
|
|
|
|
|
|
|
return True, result |
|
|
|
return True, result |
|
|
|
|
|
|
|
|
|
|
@ -639,45 +646,38 @@ class IosUtils(object): |
|
|
|
usedeviceobj = APPSuperSignUsedInfo.objects.filter(udid=udid_obj, app_id_id=app_id) |
|
|
|
usedeviceobj = APPSuperSignUsedInfo.objects.filter(udid=udid_obj, app_id_id=app_id) |
|
|
|
if usedeviceobj: |
|
|
|
if usedeviceobj: |
|
|
|
developer_obj = usedeviceobj.first().developerid |
|
|
|
developer_obj = usedeviceobj.first().developerid |
|
|
|
auth = get_auth_form_developer(developer_obj) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作 |
|
|
|
# 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作 |
|
|
|
udid_lists = list( |
|
|
|
udid_lists = list( |
|
|
|
APPSuperSignUsedInfo.objects.values_list("udid__udid__udid").filter(developerid=developer_obj)) |
|
|
|
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) |
|
|
|
DeveloperDevicesID.objects.filter(udid__appudid=udid_obj, developerid=developer_obj, |
|
|
|
DeveloperDevicesID.objects.filter(udid__appudid=udid_obj, developerid=developer_obj, |
|
|
|
app_id_id=app_id).delete() |
|
|
|
app_id_id=app_id).delete() |
|
|
|
udid_obj.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_obj = Apps.objects.filter(pk=app_id).first() |
|
|
|
app_obj = Apps.objects.filter(pk=app_id).first() |
|
|
|
app_api_obj.del_profile(app_obj.app_id) |
|
|
|
IosUtils.clean_app_by_developer_obj(app_obj, developer_obj) |
|
|
|
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_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) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def do_disable_device(developer_obj, udid_lists, udid_obj, auth): |
|
|
|
def do_disable_device(developer_obj, udid_lists, udid_obj): |
|
|
|
if udid_lists.count((udid_obj.udid.udid,)) == 1: |
|
|
|
if udid_lists.count((udid_obj.udid.udid,)) == 1: |
|
|
|
|
|
|
|
auth = get_auth_form_developer(developer_obj) |
|
|
|
app_api_obj = get_api_obj(auth) |
|
|
|
app_api_obj = get_api_obj(auth) |
|
|
|
app_api_obj.set_device_status("disable", udid_obj.udid.udid) |
|
|
|
app_api_obj.set_device_status("disable", udid_obj.udid.serial, udid_obj.udid.product, udid_obj.udid.udid) |
|
|
|
UDIDsyncDeveloper.objects.filter(udid=udid_obj.udid.udid, developerid=developer_obj).update(status=False) |
|
|
|
UDIDsyncDeveloper.objects.filter(udid=udid_obj.udid.udid, developerid=developer_obj).update(status=False) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def clean_udid_by_app_obj(app_obj, developer_obj): |
|
|
|
def clean_udid_by_app_obj(app_obj, developer_obj): |
|
|
|
|
|
|
|
|
|
|
|
auth = get_auth_form_developer(developer_obj) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作 |
|
|
|
# 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作 |
|
|
|
udid_lists = list( |
|
|
|
udid_lists = list( |
|
|
|
APPSuperSignUsedInfo.objects.values_list("udid__udid__udid").filter(developerid=developer_obj)) |
|
|
|
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) |
|
|
|
SuperSignUsed_obj.delete() |
|
|
|
SuperSignUsed_obj.delete() |
|
|
|
DeveloperDevicesID.objects.filter(udid__appudid=udid_obj, developerid=developer_obj, |
|
|
|
DeveloperDevicesID.objects.filter(udid__appudid=udid_obj, developerid=developer_obj, |
|
|
|
app_id=app_obj).delete() |
|
|
|
app_id=app_obj).delete() |
|
|
@ -696,6 +696,10 @@ class IosUtils(object): |
|
|
|
for developer_id in developer_id_lists: |
|
|
|
for developer_id in developer_id_lists: |
|
|
|
developer_obj = AppIOSDeveloperInfo.objects.filter(pk=developer_id[0]).first() |
|
|
|
developer_obj = AppIOSDeveloperInfo.objects.filter(pk=developer_id[0]).first() |
|
|
|
if developer_obj and developer_obj.user_id == app_obj.user_id: |
|
|
|
if developer_obj and developer_obj.user_id == app_obj.user_id: |
|
|
|
|
|
|
|
IosUtils.clean_super_sign_things_by_app_obj(app_obj, developer_obj) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
|
|
def clean_super_sign_things_by_app_obj(app_obj, developer_obj): |
|
|
|
IosUtils.clean_app_by_developer_obj(app_obj, developer_obj) |
|
|
|
IosUtils.clean_app_by_developer_obj(app_obj, developer_obj) |
|
|
|
delete_app_to_dev_and_file(developer_obj, app_obj.id) |
|
|
|
delete_app_to_dev_and_file(developer_obj, app_obj.id) |
|
|
|
IosUtils.clean_udid_by_app_obj(app_obj, developer_obj) |
|
|
|
IosUtils.clean_udid_by_app_obj(app_obj, developer_obj) |
|
|
@ -704,11 +708,19 @@ class IosUtils(object): |
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def clean_app_by_developer_obj(app_obj, developer_obj): |
|
|
|
def clean_app_by_developer_obj(app_obj, developer_obj): |
|
|
|
auth = get_auth_form_developer(developer_obj) |
|
|
|
auth = get_auth_form_developer(developer_obj) |
|
|
|
DeveloperAppID.objects.filter(developerid=developer_obj, app_id=app_obj).delete() |
|
|
|
developer_app_id_obj = DeveloperAppID.objects.filter(developerid=developer_obj, app_id=app_obj).first() |
|
|
|
|
|
|
|
identifier_id = None |
|
|
|
|
|
|
|
profile_id = None |
|
|
|
|
|
|
|
if developer_app_id_obj: |
|
|
|
|
|
|
|
identifier_id = developer_app_id_obj.aid |
|
|
|
|
|
|
|
profile_id = developer_app_id_obj.profile_id |
|
|
|
|
|
|
|
|
|
|
|
app_api_obj = get_api_obj(auth) |
|
|
|
app_api_obj = get_api_obj(auth) |
|
|
|
app_api_obj.del_profile(app_obj.app_id) |
|
|
|
app_api_obj.del_profile(profile_id, app_obj.app_id) |
|
|
|
app_api_obj2 = get_api_obj(auth) |
|
|
|
app_api_obj2 = get_api_obj(auth) |
|
|
|
app_api_obj2.del_app(app_obj.bundle_id, app_obj.app_id) |
|
|
|
|
|
|
|
|
|
|
|
app_api_obj2.del_app(identifier_id, app_obj.bundle_id, app_obj.app_id) |
|
|
|
|
|
|
|
developer_app_id_obj.delete() |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def clean_developer(developer_obj, user_obj, delete_file=True): |
|
|
|
def clean_developer(developer_obj, user_obj, delete_file=True): |
|
|
@ -865,11 +877,7 @@ class IosUtils(object): |
|
|
|
for developer_device_obj in developer_device_list: |
|
|
|
for developer_device_obj in developer_device_list: |
|
|
|
app_obj = developer_device_obj.app_id |
|
|
|
app_obj = developer_device_obj.app_id |
|
|
|
if APPSuperSignUsedInfo.objects.filter(developerid=developer_obj, app_id=app_obj).count() == 0: |
|
|
|
if APPSuperSignUsedInfo.objects.filter(developerid=developer_obj, app_id=app_obj).count() == 0: |
|
|
|
app_api_obj = get_api_obj(auth) |
|
|
|
IosUtils.clean_app_by_developer_obj(app_obj, developer_obj) |
|
|
|
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_to_dev_and_file(developer_obj, app_obj.pk) |
|
|
|
delete_app_profile_file(developer_obj, app_obj) |
|
|
|
delete_app_profile_file(developer_obj, app_obj) |
|
|
|
developer_device_obj.delete() |
|
|
|
developer_device_obj.delete() |
|
|
|