perf: 支持邮件模版设置

This commit is contained in:
xiaojunnuo
2025-12-14 01:36:20 +08:00
parent 437d956cad
commit a6c0d2c6f1
31 changed files with 703 additions and 214 deletions
@@ -21,10 +21,23 @@ export class EmailNotification extends BaseNotification {
receivers!: string[];
async send(body: NotificationBody) {
await this.ctx.emailService.send({
subject: body.title,
content: body.content + '\n\n[查看详情](' + body.url + ')',
receivers: this.receivers,
});
const templateData = {
...body,
}
await this.ctx.emailService.sendByTemplate({
type: body.notificationType,
data: templateData,
email: {
receivers: this.receivers,
attachments: body.attachments,
}
})
// await this.ctx.emailService.send({
// subject: body.title,
// content: body.content + '\n\n[查看详情](' + body.url + ')',
// receivers: this.receivers,
// });
}
}