fix: 上传二维码并发送 Ad Hoc 通知

This commit is contained in:
shenlei
2026-07-20 15:22:44 +09:00
parent 8c0bce45a4
commit 9b77441ec7
6 changed files with 190 additions and 5 deletions
+18
View File
@@ -24,6 +24,7 @@ from ..config import (
)
from .log_streamer import log_streamer
from .distribution import DistributionError, publish_ipa
from .notification import NotificationError, send_dingtalk_notification
from .project_patcher import ProjectPatchError, apply_project_config
@@ -444,6 +445,23 @@ async def run_build_task(task_id: str):
if task.oss_url:
await log_streamer.emit(task_id, f"下载链接: {task.oss_url}")
# App Store 仅提供 IPA 下载地址,不发送下载通知;Ad Hoc 才发送安装页二维码通知。
if task.build_type == "Ad_Hoc":
# 通知不影响已完成的打包结果,发送失败仅写入日志以便排查。
dingtalk_config = config_data.get("_upload_config", {}).get("dingtalk", {})
try:
notified = await asyncio.to_thread(
send_dingtalk_notification,
dingtalk_config,
config_data,
task.oss_url or oss_url,
task.qr_code_path or qr_code_path,
)
if notified:
await log_streamer.emit(task_id, "钉钉通知发送成功")
except NotificationError as exc:
await log_streamer.emit(task_id, f"钉钉通知未发送: {exc}", level="warn")
# 带超时执行打包
await asyncio.wait_for(_do_build(), timeout=timeout_seconds)