diff --git a/backend/services/notification.py b/backend/services/notification.py index 5ebbee6..eef732b 100644 --- a/backend/services/notification.py +++ b/backend/services/notification.py @@ -52,7 +52,8 @@ def build_dingtalk_payload( """生成与 AutoPacking/upload_iap.py 一致的钉钉 Markdown 内容。""" mobiles = _normalize_mobiles(at_mobiles) # App_Store 包与 Ad Hoc 用不同标题,App_Store 只有 IPA 下载地址、无二维码。 - heading = "【iOS】App_Store 包信息" if config_data.get("BUILD_TYPE") == "App_Store" else "【iOS】打包信息" + # 标题必须保留「打包」二字:钉钉机器人启用了自定义关键词,缺少关键词会被拒收。 + heading = "【iOS】App_Store 打包信息" if config_data.get("BUILD_TYPE") == "App_Store" else "【iOS】打包信息" details = ( f"**环境:** {config_data.get('SERVER', '')}\n\n" f"**版本:** {config_data.get('VERSION', '')}\n\n" diff --git a/tests/test_notification.py b/tests/test_notification.py index c75cb25..367fe4b 100644 --- a/tests/test_notification.py +++ b/tests/test_notification.py @@ -80,8 +80,8 @@ def test_dingtalk_payload_app_store_heading_and_no_qr(): config, "https://oss.example.com/readoor/iOS/app_2_197_1.ipa" ) text = payload["markdown"]["text"] - assert "## 【iOS】App_Store 包信息" in text - assert "## 【iOS】打包信息" not in text + # 标题保留「打包」二字,避免命中钉钉自定义关键词拦截 + assert "## 【iOS】App_Store 打包信息" in text assert "**iOS 下载链接:** https://oss.example.com/readoor/iOS/app_2_197_1.ipa" in text assert "![image]" not in text @@ -104,7 +104,7 @@ def test_dingtalk_notification_app_store_uses_own_at_list(): sent = post.call_args.kwargs["json"] assert sent["at"]["atMobiles"] == ["13911111111", "13922222222"] - assert "## 【iOS】App_Store 包信息" in sent["markdown"]["text"] + assert "## 【iOS】App_Store 打包信息" in sent["markdown"]["text"] assert "@13800000000" not in sent["markdown"]["text"]