Skip to content

Commit e3d4c2d

Browse files
committed
❤️ add feature
1 parent 84a62b3 commit e3d4c2d

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

config.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,18 @@
99
// 配置信息
1010
module.exports = {
1111
fromDisplayText: '小范大人', // 收件箱展示的来件人名字 done
12-
to: ['[email protected]', 'janet9527@qq.com', 'janet230411@163.com'], // 发送到谁,填邮箱done
12+
to: ['[email protected]','janet230411@163.com','janet9527@qq.com'], // 发送到谁,填邮箱done
1313
masterAccount: '[email protected]',
1414
location: '101210301',
1515
type: '1,2,3,5,7,9,13,15,16',
1616
startDay: '2022-07-09',
17+
marryDay:'2024-02-02',
1718
moneyRange: [0, 400],
1819
imgs: [
19-
'https://img2.imgtp.com/2024/02/16/bUZ2h1dk.webp',
20-
'https://img2.imgtp.com/2024/02/16/p05hFcD7.jpg',
21-
'https://img2.imgtp.com/2024/02/16/9M8j7bUJ.jpg',
22-
'https://img2.imgtp.com/2024/02/16/SGHlmT0H.png',
23-
'https://img2.imgtp.com/2024/02/16/0Gq1Bqx7.png',
24-
'https://img2.imgtp.com/2024/02/16/PPpjJUM9.jpg',
25-
'https://img2.imgtp.com/2024/02/16/OPnt17CQ.jpg',
26-
'https://img2.imgtp.com/2024/02/16/DhMDlO8G.jpg',
27-
'https://img2.imgtp.com/2024/02/16/74A16H7o.png',
28-
'https://img2.imgtp.com/2024/02/16/gHoMIx5H.jpg',
29-
'https://img2.imgtp.com/2024/02/16/hzuvhaWq.jpg',
20+
'https://p.sda1.dev/15/9c05c42c06e02f8228004b3ce45e0dbf/736461.png',
21+
'https://p.sda1.dev/15/c63b2d777eb3487d2930e44ee957d30e/1287141.png',
22+
'https://p.sda1.dev/15/48906ee01df78782f7da44fbd19c9e08/shanxi.jpg',
23+
'https://p.sda1.dev/15/d76f3bbf1e230e6540e979aaca11bad9/微信图片_20231214191032.jpg',
24+
'https://p.sda1.dev/15/7823c5d5b590c9cd078c1a7ed1523908/fj.png'
3025
],//随机选取一张图片 todo
3126
}

emailHtml.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ const {
2626
type,
2727
startDay,
2828
imgs,
29-
moneyRange
29+
moneyRange,
30+
marryDay
3031
} = require('./config');
3132

3233
async function init() {
@@ -57,19 +58,20 @@ async function init() {
5758
const moneyRate = Math.random();
5859
const word = `【约会基金】:范方出资 ${(money * moneyRate).toFixed(2)} 元,钱方出资 ${(money * (1 - moneyRate)).toFixed(2)} 元,共 ${money} 元。`;
5960
console.log(`🥩 此次约会基金===>[${word}]`)
60-
const img = imgs[getRandom(0, imgs.length - 1)];
61-
console.log(`🍉 此次的图片为[${img}]`)
62-
const temp = await fetch(img);
63-
const tempData = await temp.arrayBuffer();
64-
const imgurl = `data:image/${getImgeName(img)};base64,${Buffer.from(tempData, 'binary').toString('base64')}`;
6561
// 计算日期
6662
const lovingDays = dayjs(dayjs().tz('Asia/Shanghai')).diff(
6763
startDay,
6864
'days'
6965
);
70-
console.log('===♥️lovingDays===', lovingDays)
66+
console.log('===🛩️ lovingDays===', lovingDays)
67+
68+
const mD = dayjs(dayjs().tz('Asia/Shanghai')).diff(
69+
marryDay,
70+
'days'
71+
);
72+
console.log('===🥠 marryDays===', mD)
7173
// 用邮件模版生成字符串
72-
const htmlStr = emailHtml(weatherData, lifeData, word, imgurl, lovingDays);
74+
const htmlStr = emailHtml(weatherData, lifeData, word, lovingDays,mD);
7375
// 发送邮件; 本人的话一个月发一次邮件 定于每月12号发送邮件
7476
to.forEach(p => {
7577
if (p === masterAccount && dayjs().date() == 12) {

0 commit comments

Comments
 (0)