From 9353abc8a9f03c7346e8e20da184dc44559d9573 Mon Sep 17 00:00:00 2001 From: nineven Date: Mon, 7 Feb 2022 09:18:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/sysconfig.py | 30 +++++++++++------------------- fir_ser/config.py | 7 +++++++ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/fir_ser/api/utils/sysconfig.py b/fir_ser/api/utils/sysconfig.py index 5994351..76b6a80 100644 --- a/fir_ser/api/utils/sysconfig.py +++ b/fir_ser/api/utils/sysconfig.py @@ -11,7 +11,8 @@ from rest_framework import serializers from api.models import SystemConfig from common.cache.storage import SystemConfigCache -from config import BASECONF, API_DOMAIN, MOBILEPROVISION, WEB_DOMAIN, THIRDLOGINCONF, AUTHCONF, IPACONF, MSGCONF +from config import BASECONF, API_DOMAIN, MOBILEPROVISION, WEB_DOMAIN, THIRDLOGINCONF, AUTHCONF, IPACONF, MSGCONF, \ + DOWNLOADTIMESCONF logger = logging.getLogger(__name__) @@ -173,13 +174,11 @@ class GeeTestConfCache(ConfigCacheBase): @property def GEETEST_ID(self): - value = super().get_value('GEETEST_ID') - return value if value else BASECONF.GEETEST_ID + return super().get_value('GEETEST_ID', BASECONF.GEETEST_ID) @property def GEETEST_KEY(self): - value = super().get_value('GEETEST_KEY') - return value if value else BASECONF.GEETEST_KEY + return super().get_value('GEETEST_KEY', BASECONF.GEETEST_KEY) @property def GEETEST_CYCLE_TIME(self): @@ -187,18 +186,15 @@ class GeeTestConfCache(ConfigCacheBase): 定时任务初始化,该数值无效,需要在配置中定义 :return: """ - value = super().get_value('GEETEST_CYCLE_TIME') - return value if value else BASECONF.GEETEST_CYCLE_TIME + return super().get_value('GEETEST_CYCLE_TIME', BASECONF.GEETEST_CYCLE_TIME) @property def GEETEST_BYPASS_STATUS_KEY(self): - value = super().get_value('GEETEST_BYPASS_STATUS_KEY') - return value if value else BASECONF.GEETEST_BYPASS_STATUS_KEY + return super().get_value('GEETEST_BYPASS_STATUS_KEY', BASECONF.GEETEST_BYPASS_STATUS_KEY) @property def GEETEST_BYPASS_URL(self): - value = super().get_value('GEETEST_BYPASS_URL') - return value if value else BASECONF.GEETEST_BYPASS_URL + return super().get_value('GEETEST_BYPASS_URL', BASECONF.GEETEST_BYPASS_URL) class UserDownloadTimesCache(ConfigCacheBase): @@ -207,23 +203,19 @@ class UserDownloadTimesCache(ConfigCacheBase): @property def USER_FREE_DOWNLOAD_TIMES(self): - value = super().get_value('USER_FREE_DOWNLOAD_TIMES') - return value if value else 5 + return super().get_value('USER_FREE_DOWNLOAD_TIMES', DOWNLOADTIMESCONF.USER_FREE_DOWNLOAD_TIMES) @property def AUTH_USER_FREE_DOWNLOAD_TIMES(self): - value = super().get_value('AUTH_USER_FREE_DOWNLOAD_TIMES') - return value if value else 10 + return super().get_value('AUTH_USER_FREE_DOWNLOAD_TIMES', DOWNLOADTIMESCONF.AUTH_USER_FREE_DOWNLOAD_TIMES) @property def NEW_USER_GIVE_DOWNLOAD_TIMES(self): - value = super().get_value('NEW_USER_GIVE_DOWNLOAD_TIMES') - return value if value else 100 + return super().get_value('NEW_USER_GIVE_DOWNLOAD_TIMES', DOWNLOADTIMESCONF.NEW_USER_GIVE_DOWNLOAD_TIMES) @property def AUTH_USER_GIVE_DOWNLOAD_TIMES(self): - value = super().get_value('AUTH_USER_GIVE_DOWNLOAD_TIMES') - return value if value else 200 + return super().get_value('AUTH_USER_GIVE_DOWNLOAD_TIMES', DOWNLOADTIMESCONF.AUTH_USER_GIVE_DOWNLOAD_TIMES) class EmailMsgCache(ConfigCacheBase): diff --git a/fir_ser/config.py b/fir_ser/config.py index 28f6832..731afab 100644 --- a/fir_ser/config.py +++ b/fir_ser/config.py @@ -339,3 +339,10 @@ class MSGCONF(object): MSG_NOT_EXIST_DEVELOPER = '用户 %s 你好,应用 %s 签名失败了,苹果开发者总设备量已经超限,请添加新的苹果开发者或者修改开发者设备数量。感谢有你!' MSG_ERROR_DEVELOPER = '用户 %s 你好,应用 %s 签名失败了,苹果开发者 %s 信息异常,请重新检查苹果开发者状态是否正常。感谢有你!' MSG_AUTO_CHECK_DEVELOPER = '用户 %s 你好,苹果开发者 %s 信息异常,请重新检查苹果开发者状态是否正常。感谢有你!' + + +class DOWNLOADTIMESCONF(object): + USER_FREE_DOWNLOAD_TIMES = 5 + AUTH_USER_FREE_DOWNLOAD_TIMES = 10 + NEW_USER_GIVE_DOWNLOAD_TIMES = 100 + AUTH_USER_GIVE_DOWNLOAD_TIMES = 200