feat: support both code and id for access mode api

This commit is contained in:
GareArc
2025-05-28 11:14:26 +08:00
parent 2cb36a5b70
commit 14ddb90525
3 changed files with 27 additions and 4 deletions

View File

@ -395,3 +395,15 @@ class AppService:
if not site:
raise ValueError(f"App with id {app_id} not found")
return str(site.code)
@staticmethod
def get_app_id_by_code(app_code: str) -> str:
"""
Get app id by app code
:param app_code: app code
:return: app id
"""
site = db.session.query(Site).filter(Site.code == app_code).first()
if not site:
raise ValueError(f"App with code {app_code} not found")
return str(site.app_id)