From 10297e161600f20b4270711fa1aa552f1a7e9230 Mon Sep 17 00:00:00 2001 From: youngS Date: Mon, 23 Aug 2021 16:11:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=85=E7=90=86=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E6=96=87=E4=BB=B6=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/tasks.py | 4 ++-- fir_ser/api/utils/app/supersignutils.py | 2 +- fir_ser/api/utils/crontab/ctasks.py | 10 +++++----- fir_ser/api/utils/storage/caches.py | 2 +- fir_ser/fir_ser/settings.py | 1 - 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/fir_ser/api/tasks.py b/fir_ser/api/tasks.py index b52e392..4f14017 100644 --- a/fir_ser/api/tasks.py +++ b/fir_ser/api/tasks.py @@ -11,7 +11,7 @@ from api.utils.storage.storage import get_local_storage from api.models import Apps from api.utils.app.supersignutils import IosUtils, resign_by_app_id -from api.utils.crontab.ctasks import sync_download_times, auto_clean_upload_tmp_file, auto_delete_tmp_file, \ +from api.utils.crontab.ctasks import sync_download_times, auto_clean_upload_tmp_file, auto_delete_ios_mobile_tmp_file, \ auto_check_ios_developer_active from api.utils.geetest.geetest_utils import check_bypass_status @@ -74,7 +74,7 @@ def auto_clean_upload_tmp_file_job(): @app.task def auto_delete_tmp_file_job(): - auto_delete_tmp_file() + auto_delete_ios_mobile_tmp_file() @app.task diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index dd2a842..810a9d2 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -170,7 +170,7 @@ def get_auth_form_developer(developer_obj): "issuer_id": developer_obj.issuer_id, "private_key_id": developer_obj.private_key_id, "p8key": developer_obj.p8key, - "certid": developer_obj.certid + "cert_id": developer_obj.certid } else: auth = {} diff --git a/fir_ser/api/utils/crontab/ctasks.py b/fir_ser/api/utils/crontab/ctasks.py index 185ca47..3d22ffb 100644 --- a/fir_ser/api/utils/crontab/ctasks.py +++ b/fir_ser/api/utils/crontab/ctasks.py @@ -32,8 +32,8 @@ def auto_clean_upload_tmp_file(): for upload_tem_file_key in cache.iter_keys(key): data = cache.get(upload_tem_file_key) if data: - stime = data.get("stime", None) - if stime and time.time() - stime > 60 * 20: + u_time = data.get("u_time", None) + if u_time and time.time() - u_time > 60 * 20: user_obj = UserInfo.objects.filter(pk=data.get("id")).first() if user_obj: storage = Storage(user_obj) @@ -46,9 +46,9 @@ def auto_clean_upload_tmp_file(): logger.info(f"auto_clean_upload_tmp_file upload_tem_file_key :{upload_tem_file_key}") -def auto_delete_tmp_file(): - mobileconfig_tmp_dir = os.path.join(SUPER_SIGN_ROOT, 'tmp', 'mobileconfig') - for root, dirs, files in os.walk(mobileconfig_tmp_dir, topdown=False): +def auto_delete_ios_mobile_tmp_file(): + mobile_config_tmp_dir = os.path.join(SUPER_SIGN_ROOT, 'tmp', 'mobileconfig') + for root, dirs, files in os.walk(mobile_config_tmp_dir, topdown=False): now_time = time.time() for name in files: file_path = os.path.join(root, name) diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py index 0cb7dbc..992d963 100644 --- a/fir_ser/api/utils/storage/caches.py +++ b/fir_ser/api/utils/storage/caches.py @@ -231,7 +231,7 @@ def upload_file_tmp_name(act, filename, user_obj_id): tmp_key = "_".join([CACHE_KEY_TEMPLATE.get("upload_file_tmp_name_key"), filename]) if act == "set": cache.delete(tmp_key) - cache.set(tmp_key, {'time': time.time(), 'id': user_obj_id, "filename": filename}, 60 * 60) + cache.set(tmp_key, {'u_time': time.time(), 'id': user_obj_id, "filename": filename}, 2 * 60 * 60) elif act == "get": return cache.get(tmp_key) elif act == "del": diff --git a/fir_ser/fir_ser/settings.py b/fir_ser/fir_ser/settings.py index c38e804..8ca01f2 100644 --- a/fir_ser/fir_ser/settings.py +++ b/fir_ser/fir_ser/settings.py @@ -222,7 +222,6 @@ SYNC_CACHE_TO_DATABASE = { 'try_login_times': (10, 12 * 60 * 60), # 当天登录失败次数,超过该失败次数,锁定24小时 'auto_clean_tmp_file_times': 60 * 30, # 定时清理上传失误生成的临时文件 'auto_clean_local_tmp_file_times': 60 * 30, # 定时清理临时文件,现在包含超级签名描述临时文件 - 'auto_clean_apscheduler_log': 100000, # 定时清理定时任务执行的日志,该日志存在数据库中,该参数为日志保留的数量 'try_send_msg_over_limit_times': (3, 60 * 60), # 每小时用户发送信息次数 'clean_local_tmp_file_from_mtime': 60 * 60, # 清理最后一次修改时间超过限制时间的临时文件,单位秒 'auto_check_ios_developer_active_times': 60 * 60 * 12, # ios开发者证书检测时间