From 8a59b8d32943379960ce92c5ae88d9ca5f4bf03f Mon Sep 17 00:00:00 2001 From: youngS Date: Fri, 26 Nov 2021 16:10:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/app/iossignapi.py | 2 +- fir_ser/api/utils/app/supersignutils.py | 4 ++-- fir_ser/api/utils/modelutils.py | 6 ++++-- fir_ser/api/utils/storage/caches.py | 7 +++++++ fir_ser/fir_ser/settings.py | 2 ++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/fir_ser/api/utils/app/iossignapi.py b/fir_ser/api/utils/app/iossignapi.py index c3d29fa..bdbdc0c 100644 --- a/fir_ser/api/utils/app/iossignapi.py +++ b/fir_ser/api/utils/app/iossignapi.py @@ -209,7 +209,7 @@ class AppDeveloperApiV2(object): certificates = apple_obj.get_all_certificates() result['data'] = certificates logger.info(f"ios developer active result:{certificates}") - if len(certificates) > 0: + if len(certificates) >= 0: return True, result except Exception as e: logger.error(f"ios developer active Failed Exception:{e}") diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index c7fa0a9..43e00d6 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -251,13 +251,13 @@ def get_developer_user_by_app_udid(user_objs, udid, app_obj): # 根据udid和应用查找该用户开发者账户【主要可能是开发者未激活】 developer_obj = AppIOSDeveloperInfo.objects.filter( - pk__in=developer_udid_obj_list.filter(udid=udid, developerid__apptodeveloper__app_id=app_obj)).first() + pk__in=developer_udid_obj_list.filter(udid=udid, developerid__apptodeveloper__app_id=app_obj)).last() if developer_obj: logger.info(f'udid:{udid} app_obj:{app_obj} return') return developer_obj, True # 根据udid查找开发者账户 - developer_obj = AppIOSDeveloperInfo.objects.filter(pk__in=developer_udid_obj_list.filter(udid=udid)).first() + developer_obj = AppIOSDeveloperInfo.objects.filter(pk__in=developer_udid_obj_list.filter(udid=udid)).last() if developer_obj: logger.info(f'udid:{udid} only and return') return developer_obj, True diff --git a/fir_ser/api/utils/modelutils.py b/fir_ser/api/utils/modelutils.py index b54d592..651d9e0 100644 --- a/fir_ser/api/utils/modelutils.py +++ b/fir_ser/api/utils/modelutils.py @@ -158,14 +158,16 @@ def get_developer_can_used_from_public_sign(user_obj): o_number_info = IosDeveloperPublicPoolBill.objects.filter(to_user_id__isnull=False, user_id=user_obj).values( 'number').aggregate(number=Sum('number')) o_number = o_number_info.get("number", 0) - + if o_number is None: + o_number = 0 u_number_info = IosDeveloperPublicPoolBill.objects.filter( user_id_id__in=IosDeveloperPublicPoolBill.objects.filter(user_id=user_obj).values('to_user_id_id')).values( 'number', 'udid_sync_info_id').annotate( counts=Count('udid_sync_info_id')).aggregate(number=Sum('number')) u_number = u_number_info.get("number", 0) - + if u_number is None: + u_number = 0 return o_number - u_number diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py index e858e61..0c4dac9 100644 --- a/fir_ser/api/utils/storage/caches.py +++ b/fir_ser/api/utils/storage/caches.py @@ -155,6 +155,12 @@ def del_short_cache(short): cache.delete(app_download_key) +def del_make_token_key_cache(release_id): + key = "_".join(['', CACHE_KEY_TEMPLATE.get("make_token_key"), f"{release_id}*"]) + for make_token_key in cache.iter_keys(key): + cache.delete(make_token_key) + + def del_cache_response_by_short_util(short, app_id, udid): logger.info(f"del_cache_response_by_short short:{short} app_id:{app_id} udid:{udid}") del_short_cache(short) @@ -170,6 +176,7 @@ def del_cache_response_by_short_util(short, app_id, udid): cache.delete("_".join([key, download_val, master_release_dict.get('release_id'), udid])) cache.delete( "_".join([key, CACHE_KEY_TEMPLATE.get("make_token_key"), master_release_dict.get('release_id'), udid])) + del_make_token_key_cache(master_release_dict.get('release_id')) def del_cache_by_delete_app(app_id): diff --git a/fir_ser/fir_ser/settings.py b/fir_ser/fir_ser/settings.py index 6bb85d2..ed581fe 100644 --- a/fir_ser/fir_ser/settings.py +++ b/fir_ser/fir_ser/settings.py @@ -179,6 +179,8 @@ REST_FRAMEWORK_EXTENSIONS = { # 缓存存储 'DEFAULT_USE_CACHE': 'default', } +# 取消自动加斜杠 +APPEND_SLASH = False # geetest 配置信息 GEETEST_ID = BASECONF.GEETEST_ID