// 直接测试短信发送功能 const log = { app: console.log }; const AlertLevel: Record = { 1: '一级告警', 2: '二级告警', 3: '三级告警' }; // 模拟短信发送 async function testSmsSend() { const phone = '13800138000'; const username = 'testuser'; const alert = { device_id: 'device001', alert_level: 1, alert_message: '温度过高', created_at: new Date().toISOString() }; const smsContent = `【告警通知】 设备ID: ${alert.device_id} 告警级别: ${AlertLevel[alert.alert_level] || '未知'} 告警时间: ${new Date(alert.created_at).toLocaleString()} 告警内容: ${alert.alert_message}`; console.log('=== 测试短信发送 ==='); console.log('接收号码:', phone); console.log('短信内容:\n', smsContent); console.log('==================='); log.app(`成功发送短信通知给用户 ${username}(${phone})`); } console.log('开始测试短信通知...'); testSmsSend() .then(() => console.log('测试完成')) .catch(err => console.error('测试失败:', err));