refactor: xpack license

This commit is contained in:
wxg0103 2025-06-16 15:08:33 +08:00
parent 1ea78ea0c7
commit d8ca74a2f5
3 changed files with 5 additions and 4 deletions

View File

@ -39,8 +39,8 @@ class ChatEmbedSerializer(serializers.Serializer):
is_draggable = 'false'
show_guide = 'true'
float_icon = f"{self.data.get('protocol')}://{self.data.get('host')}/ui/MaxKB.gif"
xpack_cache = DatabaseModelManage.get_model('xpack_cache')
X_PACK_LICENSE_IS_VALID = False if xpack_cache is None else xpack_cache.get('XPACK_LICENSE_IS_VALID', False)
is_license_valid = DatabaseModelManage.get_model('license_is_valid')
X_PACK_LICENSE_IS_VALID = is_license_valid if is_license_valid is not None else False
# 获取接入的query参数
query = self.get_query_api_input(application_access_token.application, params)
float_location = {"x": {"type": "right", "value": 0}, "y": {"type": "bottom", "value": 30}}

View File

@ -237,8 +237,8 @@ def query_params_to_single_dict(query_params: Dict):
def valid_license(model=None, count=None, message=None):
def inner(func):
def run(*args, **kwargs):
xpack_cache = DatabaseModelManage.get_model('xpack_cache')
is_license_valid = xpack_cache.get('XPACK_LICENSE_IS_VALID', False) if xpack_cache is not None else False
is_license_valid = DatabaseModelManage.get_model('license_is_valid')
is_license_valid = is_license_valid if is_license_valid is not None else False
record_count = QuerySet(model).count()
if not is_license_valid and record_count >= count:

View File

@ -57,6 +57,7 @@ pypdf = "5.6.0"
gunicorn = "23.0.0"
python-daemon = "3.1.2"
pytz = "2025.2"
django-apscheduler = "0.6.2"
[build-system]
requires = ["poetry-core"]