feat: 支持按项目配置钉钉通知 @ 名单

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-11-03 09:59:05 +09:00
co-authored by Claude Opus 5.5
parent a4cd855b0c
commit 10c39b5116
7 changed files with 90 additions and 6 deletions
+6 -1
View File
@@ -15,6 +15,8 @@ config.json 结构:
"app_fields": [], # App 的项目自定义字段 [{key, label, required}]
"server_fields": [], # 服务器环境的项目自定义字段
"obfuscation": false, # 是否支持代码混淆
"dingtalk_at": {"at_mobiles": [], "at_mobiles_app_store": []},
# 本项目钉钉 @ 名单,为空则用 upload.dingtalk 的全局名单
# —— 项目数据(与原单项目时的顶层字段相同)——
"apps": {}, "schemes": {}, "servers": {}, "branches": [], "tags": [],
"versions": {}, "branch_track": {}, "next_app_id_prefix": 1
@@ -48,7 +50,7 @@ PATCHERS = (PATCHER_READOOR, PATCHER_GENERIC)
# 项目定义字段;其余字段(apps、schemes、versions 等)都是项目数据。
DEFINITION_KEYS = (
"name", "git", "source_dir", "xcode", "copy_items", "patcher",
"patch_rules", "app_fields", "server_fields", "obfuscation",
"patch_rules", "app_fields", "server_fields", "obfuscation", "dingtalk_at",
)
# 原单项目(阅门户)的定义,迁移旧配置时写入。
@@ -63,6 +65,7 @@ LEGACY_PROJECT_DEFINITION = {
"app_fields": [],
"server_fields": [],
"obfuscation": True,
"dingtalk_at": {"at_mobiles": [], "at_mobiles_app_store": []},
}
# 当前请求操作的项目,由 main.py 的中间件按请求头 X-Project 设置;
@@ -93,6 +96,7 @@ def default_definition(project_id: str) -> dict:
"app_fields": [],
"server_fields": [],
"obfuscation": False,
"dingtalk_at": {"at_mobiles": [], "at_mobiles_app_store": []},
}
@@ -102,6 +106,7 @@ def get_definition(project_id: str, project: dict) -> dict:
definition = {key: project.get(key, defaults[key]) for key in DEFINITION_KEYS}
definition["git"] = {**defaults["git"], **(definition.get("git") or {})}
definition["xcode"] = {**defaults["xcode"], **(definition.get("xcode") or {})}
definition["dingtalk_at"] = {**defaults["dingtalk_at"], **(definition.get("dingtalk_at") or {})}
if definition["patcher"] not in PATCHERS:
definition["patcher"] = PATCHER_GENERIC
return definition