feat: 定制需求提交时发送邮件通知
- 新增 nodemailer 依赖,通过腾讯企业邮 SMTP 发送邮件 - 新建 server/utils/email.js 邮件发送工具 - 定制表单提交后企业微信和邮件通知并行发送 - 不配置 SMTP 环境变量时静默跳过,不影响原有流程 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
这个提交包含在:
@@ -20,6 +20,7 @@
|
||||
|
||||
import { checkRateLimit } from '../utils/rateLimit'
|
||||
import { notifyWecom } from '../utils/notify'
|
||||
import { notifyEmail } from '../utils/email'
|
||||
import { useDB, schema } from '../utils/db.js'
|
||||
|
||||
// 手机号正则
|
||||
@@ -93,8 +94,8 @@ export default defineEventHandler(async (event) => {
|
||||
.returning()
|
||||
.all()
|
||||
|
||||
// ── 飞书通知(配置后生效)────────────────────────────
|
||||
await notifyWecom('🌿 新定制需求 - 呼籁旅行', {
|
||||
// ── 通知(配置后生效)────────────────────────────────
|
||||
const notifyFields = {
|
||||
'编号': String(record.id),
|
||||
'姓名': formData.name,
|
||||
'手机': formData.phone,
|
||||
@@ -105,7 +106,12 @@ export default defineEventHandler(async (event) => {
|
||||
'特殊需求': formData.activities.length ? formData.activities.join('、') : '无',
|
||||
'预算': formData.budget || '未选择',
|
||||
'补充说明': formData.remarks || '无',
|
||||
})
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
notifyWecom('🌿 新定制需求 - 呼籁旅行', notifyFields),
|
||||
notifyEmail('🌿 新定制需求 - 呼籁旅行', notifyFields),
|
||||
])
|
||||
|
||||
// ── 返回 ──────────────────────────────────────────────
|
||||
return {
|
||||
|
||||
在新工单中引用
屏蔽一个用户