profile_mail.js
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const mail = require('../../models/mail');
const moment = require('moment');
function reporter(data, cb) {
const mailOptions = {
from: 'automan@yoho.cn',
to: 'webtech@yoho.cn',
subject: `线上项目错误结果最近三天结果汇总 ` + moment().format('YYYY-MM-DD HH:mm:ss'),
html: tpl(data['yohobuy-node']) + tpl(data['yohobuywap-node'])
};
mail.sendMail(mailOptions, cb)
}
function tpl ({name, one, two, three}) {
return `<div style="margin-bottom: 20px">
<div style="font-size: 20px">${name}</div>
<table border=="1">
<thead>
<td></td>
<td>${one.time}</td>
<td>${two.time}</td>
<td>${three.time}</td>
</thead>
<tbody>
<tr>
<td>前端</td>
<td>${one.client}</td>
<td>${two.client}</td>
<td>${three.client}</td>
</tr>
<tr>
<td>后端</td>
<td>${one.server}</td>
<td>${two.server}</td>
<td>${three.server}</td>
</tr>
</tbody>
</table>
<div><a href="http://node-ci.yohops.com/profile/error">点这里去 node-ci 查看</a></div>
</div>`
}
module.exports = {
reporter
};