From c71ba5d7b37f6ee451db33dcf3f4dc3d5a00969b Mon Sep 17 00:00:00 2001 From: blackholll Date: Sun, 27 Feb 2022 09:54:35 +0800 Subject: [PATCH] trigger notice after change ticket's state --- service/ticket/ticket_base_service.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/service/ticket/ticket_base_service.py b/service/ticket/ticket_base_service.py index 2c7c3968..965587f9 100644 --- a/service/ticket/ticket_base_service.py +++ b/service/ticket/ticket_base_service.py @@ -1605,15 +1605,20 @@ def update_ticket_state(cls, ticket_id: int, state_id: int, username: str, sugge participant=username, state_id=source_state_id, ticket_data=all_ticket_data_json)) + # 如果目标状态是脚本处理中,需要触发脚本处理 if ticket_obj.participant_type_id == constant_service_ins.PARTICIPANT_TYPE_ROBOT: from tasks import run_flow_task # 放在文件开头会存在循环引用 run_flow_task.apply_async(args=[ticket_id, ticket_obj.participant, ticket_obj.state_id], queue='loonflow') - # 目标状态处理人类型是hook,需要出发hook - if ticket_obj.participant_type_id == constant_service_ins.PARTICIPANT_TYPE_HOOK: + # 目标状态处理人类型是hook,需要触发hook + elif ticket_obj.participant_type_id == constant_service_ins.PARTICIPANT_TYPE_HOOK: from tasks import flow_hook_task # 放在文件开头会存在循环引用 flow_hook_task.apply_async(args=[ticket_id], queue='loonflow') + else: + # 通知消息 + from tasks import send_ticket_notice + send_ticket_notice.apply_async(args=[ticket_id], queue='loonflow') return True, '修改工单状态成功'