feat(license): refactor available team members handling in feature service.

- add tenant_id support to info request methods
This commit is contained in:
zhangx1n 2025-03-31 17:26:02 +08:00
parent 3603418bc6
commit 2e419ca3ba
2 changed files with 8 additions and 3 deletions

View File

@ -13,8 +13,10 @@ class EnterpriseRequest:
} }
@classmethod @classmethod
def send_request(cls, method, endpoint, json=None, params=None): def send_request(cls, method, endpoint, json=None, params=None, tenant_id=None):
headers = {"Content-Type": "application/json", "Enterprise-Api-Secret-Key": cls.secret_key} headers = {"Content-Type": "application/json", "Enterprise-Api-Secret-Key": cls.secret_key}
if tenant_id:
headers["X-Tenant-ID"] = tenant_id
url = f"{cls.base_url}{endpoint}" url = f"{cls.base_url}{endpoint}"
response = requests.request(method, url, json=json, params=params, headers=headers, proxies=cls.proxies) response = requests.request(method, url, json=json, params=params, headers=headers, proxies=cls.proxies)
return response.json() return response.json()

View File

@ -1,10 +1,13 @@
from contexts import tenant_id
from services.enterprise.base import EnterpriseRequest from services.enterprise.base import EnterpriseRequest
from flask import request
from libs.passport import PassportService
class EnterpriseService: class EnterpriseService:
@classmethod @classmethod
def get_info(cls): def get_info(cls, tenant_id=None):
return EnterpriseRequest.send_request("GET", "/info") return EnterpriseRequest.send_request("GET", "/info", tenant_id=tenant_id)
@classmethod @classmethod
def get_app_web_sso_enabled(cls, app_code): def get_app_web_sso_enabled(cls, app_code):