From 4e697cdf936941dcbcedb8b99a82c489327ff145 Mon Sep 17 00:00:00 2001 From: arthurhuang Date: Tue, 21 Jan 2025 15:08:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9build=5Fmessage?= =?UTF-8?q?=E5=A4=9A=E6=AC=A1=E4=BC=A0=E5=8F=82task=5Fid=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20#1464?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- itsm/ticket/tasks.py | 2 +- itsm/ticket/utils.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/itsm/ticket/tasks.py b/itsm/ticket/tasks.py index b8692371..a2442761 100644 --- a/itsm/ticket/tasks.py +++ b/itsm/ticket/tasks.py @@ -275,7 +275,7 @@ def retry_notify(ticket, state_id, receivers): @shared_task def notify_task(ticket, receivers, message, action, **kwargs): """发送通知""" - task_id = kwargs.get("task_id") + task_id = kwargs.pop("task_id", None) # 关闭通知服务 if CLOSE_NOTIFY == "close": diff --git a/itsm/ticket/utils.py b/itsm/ticket/utils.py index d08d394c..61b73db1 100644 --- a/itsm/ticket/utils.py +++ b/itsm/ticket/utils.py @@ -102,6 +102,9 @@ def build_message(_notify, task_id, ticket, message, action, **kwargs): else: custom_notify = get_custom_notify(ticket, action, _notify.type) + if task_id is not None: + kwargs["task_id"] = task_id + # 获取单据上下文 context = ticket.get_notify_context() context.update(