From 32c3058d576a17640f28c9c14f7c849628174c44 Mon Sep 17 00:00:00 2001 From: nineven Date: Sun, 20 Mar 2022 00:42:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B4=A6=E6=88=B7=E6=BF=80?= =?UTF-8?q?=E6=B4=BB=E6=A3=80=E6=B5=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_client/vue.config.js | 2 +- fir_ser/common/base/magic.py | 2 +- fir_ser/xsign/utils/supersignutils.py | 40 ++++++++++++++------------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/fir_client/vue.config.js b/fir_client/vue.config.js index edaaf24..98cb3a5 100644 --- a/fir_client/vue.config.js +++ b/fir_client/vue.config.js @@ -82,7 +82,7 @@ if (page) { } } -const version='2.2.2'; +const version='2.2.3'; const pro_base_env = { baseUrl: 'https://flyapps.cn', diff --git a/fir_ser/common/base/magic.py b/fir_ser/common/base/magic.py index 1ab1172..d5c028b 100644 --- a/fir_ser/common/base/magic.py +++ b/fir_ser/common/base/magic.py @@ -57,7 +57,7 @@ def call_function_try_attempts(try_attempts=3, sleep_time=2, failed_callback=Non logger.error(f'exec {func} failed after the maximum number of attempts. Failed:{res[1]}') if failed_callback: logger.error(f'exec {func} failed and exec failed callback {failed_callback.__name__}') - failed_callback(*args, **kwargs) + failed_callback(*args, **kwargs, result=res) logger.info(f"exec {func} finished. time:{time.time() - start_time}") return res diff --git a/fir_ser/xsign/utils/supersignutils.py b/fir_ser/xsign/utils/supersignutils.py index 161eb87..33d1ea7 100644 --- a/fir_ser/xsign/utils/supersignutils.py +++ b/fir_ser/xsign/utils/supersignutils.py @@ -406,18 +406,6 @@ def check_sign_is_exists(user_obj, app_obj, udid, developer_obj, sign=True): logger.warning(f"udid {udid} not exist app_id {app_obj} . start find developer and sign") -def active_failed_callback(*args, **kwargs): - developer_obj, auto_clean = args - if auto_clean: - logger.warning(f"clean developer {developer_obj}") - IosUtils.clean_developer(developer_obj, developer_obj.user_id) - developer_obj.certid = None - developer_obj.cert_expire_time = None - else: - developer_obj.status = 4 - developer_obj.save(update_fields=['certid', 'cert_expire_time', 'status']) - - class IosUtils(object): def __init__(self, udid_info, user_obj, app_obj=None): self.developer_obj = None @@ -1033,10 +1021,10 @@ class IosUtils(object): return False, {'err_info': str(e)} @staticmethod - @call_function_try_attempts(failed_callback=active_failed_callback) - def active_developer(developer_obj, auto_clean=True): + def active_developer(developer_obj, auto_clean=True, loop_count=1): """ 激活开发者账户 + :param loop_count: :param auto_clean: :param developer_obj: :return: @@ -1052,11 +1040,25 @@ class IosUtils(object): break developer_obj.status = 1 if developer_obj.certid and len(developer_obj.certid) > 3 and cert_is_exists and len(result) > 0: - # 数据库证书id和苹果开发id不一致,可认为被用户删掉,需要执行清理开发者操作 - if auto_clean: - # 捕获失败结果,三次重试之后,执行callback 方法,避免一次执行失败直接清理数据 - return False, {'return_info': '证书检测有误'} - developer_obj.status = 4 + # 多次判断数据库证书id和苹果开发id不一致,可认为被用户删掉,需要执行清理开发者操作 + if loop_count > 3: + if auto_clean: + logger.warning(f"clean developer {developer_obj}") + IosUtils.clean_developer(developer_obj, developer_obj.user_id) + developer_obj.certid = None + developer_obj.cert_expire_time = None + # 捕获失败结果,三次重试之后,执行callback 方法,避免一次执行失败直接清理数据 + return False, {'return_info': '证书检测有误'} + else: + developer_obj.status = 4 + developer_obj.save(update_fields=['certid', 'cert_expire_time', 'status']) + + else: + loop_count += 1 + logger.info( + f"{developer_obj} loop check developer cert.auto_clean:{auto_clean} loop_count:{loop_count}") + return IosUtils.active_developer(developer_obj, auto_clean, loop_count) + developer_obj.save(update_fields=['certid', 'cert_expire_time', 'status']) return status, result