From cb71d238bc686fa2cc5312344b22777f24e688b7 Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Mon, 16 Nov 2020 14:14:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B6=85=E7=BA=A7=E7=AD=BE?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=EF=BC=8C=E5=AF=BC=E8=87=B4=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E7=9A=84=E5=8C=85=E4=B8=BA=E8=80=81=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/app/supersignutils.py | 23 +++++++++++++++++++---- fir_ser/api/utils/storage/caches.py | 7 ++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index be0a42e..a3b7026 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -4,7 +4,7 @@ # author: liuyu # date: 2020/3/6 -import uuid, xmltodict, os, re, logging +import uuid, xmltodict, os, re, logging, time from fir_ser.settings import SUPER_SIGN_ROOT, MEDIA_ROOT, SERVER_DOMAIN, MOBILECONFIG_SIGN_SSL from api.utils.app.iossignapi import AppDeveloperApi, ResignApp from api.models import APPSuperSignUsedInfo, AppUDID, AppIOSDeveloperInfo, AppReleaseInfo, Apps, APPToDeveloper, \ @@ -13,7 +13,8 @@ from api.utils.app.randomstrings import make_app_uuid, make_from_user_uuid from api.utils.serializer import get_developer_udided from api.utils.storage.localApi import LocalStorage from api.utils.storage.caches import del_cache_response_by_short -from api.utils.utils import file_format_path, delete_app_to_dev_and_file, delete_app_profile_file +from api.utils.utils import file_format_path, delete_app_to_dev_and_file, delete_app_profile_file, \ + send_ios_developer_active_status logger = logging.getLogger(__file__) @@ -223,12 +224,26 @@ class IosUtils(object): logger.info("udid %s exists app_id %s" % (self.udid_info.get('udid'), self.app_obj)) return logger.info("udid %s not exists app_id %s ,need sign" % (self.udid_info.get('udid'), self.app_obj)) - status, result = self.download_profile() - if not status: + fcount = 3 + while fcount > 0: + status, result = self.download_profile() + if not status: + fcount -= 1 + logger.warning("udid %s app %s developer %s sign failed %s .try again " % ( + self.udid_info.get('udid'), self.app_obj, self.developer_obj, result)) + time.sleep(3) + else: + fcount = -1 + if fcount != -1: logger.error("udid %s app %s developer %s sign failed %s" % ( self.udid_info.get('udid'), self.app_obj, self.developer_obj, result)) self.developer_obj.is_actived = False self.developer_obj.save() + send_ios_developer_active_status(self.developer_obj, + 'app %s developer %s sign failed %s. disable this developer' % ( + self.app_obj, self.developer_obj, result)) + self.get_developer_auth() + self.resign() return file_format_path_name = file_format_path(self.user_obj, self.auth) diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py index 3d0234e..ff46de2 100644 --- a/fir_ser/api/utils/storage/caches.py +++ b/fir_ser/api/utils/storage/caches.py @@ -45,8 +45,13 @@ def get_download_url_by_cache(app_obj, filename, limit, isdownload=True, key='', APPToDeveloper_obj = APPToDeveloper.objects.filter(app_id_id=app_obj.get("pk"), developerid=SuperSign_obj.developerid).first() if APPToDeveloper_obj: + release_obj = AppReleaseInfo.objects.filter(app_id_id=app_obj.get("pk"), is_master=True).first() + if release_obj.release_id == APPToDeveloper_obj.release_file: + binary_file = APPToDeveloper_obj.binary_file + else: + binary_file = APPToDeveloper_obj.release_file return local_storage.get_download_url( - APPToDeveloper_obj.binary_file + "." + download_url_type, limit), "" + binary_file + "." + download_url_type, limit), "" else: return "", "" else: