From b4a1cb47ae6313099628c552811da01cfdb011a1 Mon Sep 17 00:00:00 2001 From: nineven Date: Mon, 1 Feb 2021 16:54:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=B9=E6=9E=9C=E5=BC=80=E5=8F=91=E8=B4=A6?= =?UTF-8?q?=E6=88=B7=E4=BB=85=E5=90=8C=E6=AD=A5enable=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/app/iossignapi.py | 16 +++++++++++++++- fir_ser/api/utils/app/supersignutils.py | 9 ++++++--- fir_ser/api/utils/apple/appleapiv3.py | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/fir_ser/api/utils/app/iossignapi.py b/fir_ser/api/utils/app/iossignapi.py index a061e76..2d46275 100644 --- a/fir_ser/api/utils/app/iossignapi.py +++ b/fir_ser/api/utils/app/iossignapi.py @@ -100,7 +100,7 @@ class AppDeveloperApi(object): self.cmd = self.cmd + " device get '%s' " % (self.file_format_path_name(user_obj)) return exec_shell(self.cmd) - def add_app(self, bundleId, app_id): + def create_app(self, bundleId, app_id): self.cmd = self.cmd + " app add '%s' '%s'" % (bundleId, app_id) result = exec_shell(self.cmd) @@ -288,3 +288,17 @@ class AppDeveloperApiV2(object): logger.error("ios developer delete profile Failed Exception:%s" % e) result['return_info'] = "%s" % e return False, result + + def create_app(self, bundleId, app_id): + result = {} + try: + apple_obj = AppStoreConnectApi(self.issuer_id, self.private_key_id, self.p8key) + bundle_obj = apple_obj.register_bundle_id_enable_capability(app_id, bundleId + app_id) + developer_app_id = bundle_obj.id + result['aid'] = developer_app_id + return True, result + + except Exception as e: + logger.error("ios developer create app Failed Exception:%s" % e) + result['return_info'] = "%s" % e + return False, result diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index 9fbbdcb..1407ad6 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -242,6 +242,11 @@ class IosUtils(object): return get_api_obj(self.auth).get_profile(bundleId, app_id, device_udid, device_name, self.get_profile_full_path(), self.auth, developer_app_id, device_id_list) + # 开启超级签直接在开发者账户创建 + def create_app(self, app_obj): + bundleId = self.app_obj.bundle_id + app_id = self.app_obj.app_id + return get_api_obj(self.auth).create_app(bundleId, app_id) def get_profile_full_path(self): cert_dir_name = make_app_uuid(self.user_obj, get_apple_udid_key(self.auth)) @@ -261,14 +266,12 @@ class IosUtils(object): return logger.info("udid %s not exists app_id %s ,need sign" % (self.udid_info.get('udid'), self.app_obj)) fcount = 3 + result={} while fcount > 0: # apptodev_obj = APPToDeveloper.objects.filter(developerid=self.developer_obj, app_id=self.app_obj).first() device_id_list = DeveloperDevicesID.objects.filter(app_id=self.app_obj, developerid=self.developer_obj).values_list('did') - # first_sign = True - # if apptodev_obj: - # first_sign = False developer_app_id = None developer_appid_obj = DeveloperAppID.objects.filter(developerid=self.developer_obj, app_id=self.app_obj).first() diff --git a/fir_ser/api/utils/apple/appleapiv3.py b/fir_ser/api/utils/apple/appleapiv3.py index 5e5f98d..e992e53 100644 --- a/fir_ser/api/utils/apple/appleapiv3.py +++ b/fir_ser/api/utils/apple/appleapiv3.py @@ -679,7 +679,7 @@ class AppStoreConnectApi(DevicesAPI, BundleIDsAPI, BundleIDsCapabilityAPI, Profi return self.__device_store(req) def list_enabled_devices(self): - req = self.list_devices() + req = super().list_enabled_devices() return self.__device_store(req) def get_all_bundle_ids(self):