修复高风险预警邮件通知并补充测试
This commit is contained in:
@@ -93,6 +93,22 @@ class RiskNotificationService:
|
||||
self.session.add(notification)
|
||||
return notification
|
||||
|
||||
def mark_mail_sent(self, notification: FundRiskNotification) -> None:
|
||||
"""邮件发送成功后回写通知状态。"""
|
||||
notification.send_status = "已发送"
|
||||
notification.sent_at = _now()
|
||||
notification.fail_reason = None
|
||||
|
||||
def mark_mail_failed(
|
||||
self,
|
||||
notification: FundRiskNotification,
|
||||
reason: str,
|
||||
) -> None:
|
||||
"""邮件发送失败后保留通知记录并记录安全失败原因。"""
|
||||
notification.send_status = "发送失败"
|
||||
notification.sent_at = None
|
||||
notification.fail_reason = reason.strip()[:500] or "邮件发送失败"
|
||||
|
||||
def create_high_risk_records(
|
||||
self,
|
||||
alerts: list[FundRiskAlert],
|
||||
|
||||
Reference in New Issue
Block a user