From b92c3399e1737c791b8c5154f4f27bd65c36b3cc Mon Sep 17 00:00:00 2001 From: logan Date: Mon, 25 May 2026 01:30:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=A1=E6=89=B9=E6=8B=92=E7=BB=9D?= =?UTF-8?q?=E4=B8=8D=E5=8F=91=E9=80=9A=E7=9F=A5=EF=BC=8C=E4=BB=85=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E5=88=9B=E5=BB=BA/=E5=AE=A1=E6=89=B9=E9=80=9A?= =?UTF-8?q?=E8=BF=87/=E6=89=A7=E8=A1=8C=E7=BB=93=E6=9E=9C=E4=B8=89?= =?UTF-8?q?=E4=B8=AA=E9=80=9A=E7=9F=A5=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/v1/endpoints/ticket.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/app/api/v1/endpoints/ticket.py b/backend/app/api/v1/endpoints/ticket.py index 469f6b5..bf82fdd 100644 --- a/backend/app/api/v1/endpoints/ticket.py +++ b/backend/app/api/v1/endpoints/ticket.py @@ -670,15 +670,15 @@ async def review_ticket( await db.commit() await db.refresh(ticket) - # 发送审批通知 - try: - event_type = "ticket_approved" if data.action == "approve" else "ticket_rejected" - await _send_ticket_notification(db, ticket, event_type, { - "approver": current_user.display_name, - "comment": data.comment or ("审批通过" if data.action == "approve" else "审批拒绝"), - }) - except Exception as notify_err: - logger.error("审批通知发送失败: %s", notify_err) + # 发送审批通知(仅审批通过时通知,拒绝不通知) + if data.action == "approve": + try: + await _send_ticket_notification(db, ticket, "ticket_approved", { + "approver": current_user.display_name, + "comment": data.comment or "审批通过", + }) + except Exception as notify_err: + logger.error("审批通知发送失败: %s", notify_err) return await _enrich_ticket(ticket, db)