diff --git a/backend/routers/config.py b/backend/routers/config.py index 2d49457..515e3e5 100644 --- a/backend/routers/config.py +++ b/backend/routers/config.py @@ -254,6 +254,14 @@ def _apply_special_app_prefix_override(app: dict) -> None: app["app_id_prefix_override"] = 1 +def _normalize_tencent_app_id(app: dict) -> None: + """腾讯 AppID 统一带 tencent 前缀(允许只填数字 ID)。""" + value = str(app.get("tencent") or "").strip() + if not value: + return + app["tencent"] = value if value.startswith("tencent") else f"tencent{value}" + + def _next_app_id(apps: dict, servers: dict, app: dict) -> str: """根据环境前缀或 App 特殊覆盖生成下一个配置 ID。""" prefix = app.get("app_id_prefix_override") @@ -412,6 +420,7 @@ async def create_app(app: dict): # 按服务环境自动生成三位 ID(例如测试环境 1xx、正式环境 2xx)。 _apply_special_app_prefix_override(app) + _normalize_tencent_app_id(app) new_id = _next_app_id(apps, config.get("servers", {}), app) # 自动生成 upload_key @@ -434,6 +443,7 @@ async def update_app(app_id: str, app: dict): if app_id not in apps: raise HTTPException(status_code=404, detail="App 不存在") + _normalize_tencent_app_id(app) apps[app_id] = app config["apps"] = apps save_config(config) diff --git a/frontend/src/views/ConfigView.vue b/frontend/src/views/ConfigView.vue index 4ecb2aa..d63cdb0 100644 --- a/frontend/src/views/ConfigView.vue +++ b/frontend/src/views/ConfigView.vue @@ -491,7 +491,7 @@