Skip to content

Commit

Permalink
❤️ add feature
Browse files Browse the repository at this point in the history
  • Loading branch information
24min committed Feb 16, 2024
1 parent 84a62b3 commit e3d4c2d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
19 changes: 7 additions & 12 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,18 @@
// 配置信息
module.exports = {
fromDisplayText: '小范大人', // 收件箱展示的来件人名字 done
to: ['[email protected]', 'janet9527@qq.com', 'janet230411@163.com'], // 发送到谁,填邮箱done
to: ['[email protected]','janet230411@163.com','janet9527@qq.com'], // 发送到谁,填邮箱done
masterAccount: '[email protected]',
location: '101210301',
type: '1,2,3,5,7,9,13,15,16',
startDay: '2022-07-09',
marryDay:'2024-02-02',
moneyRange: [0, 400],
imgs: [
'https://img2.imgtp.com/2024/02/16/bUZ2h1dk.webp',
'https://img2.imgtp.com/2024/02/16/p05hFcD7.jpg',
'https://img2.imgtp.com/2024/02/16/9M8j7bUJ.jpg',
'https://img2.imgtp.com/2024/02/16/SGHlmT0H.png',
'https://img2.imgtp.com/2024/02/16/0Gq1Bqx7.png',
'https://img2.imgtp.com/2024/02/16/PPpjJUM9.jpg',
'https://img2.imgtp.com/2024/02/16/OPnt17CQ.jpg',
'https://img2.imgtp.com/2024/02/16/DhMDlO8G.jpg',
'https://img2.imgtp.com/2024/02/16/74A16H7o.png',
'https://img2.imgtp.com/2024/02/16/gHoMIx5H.jpg',
'https://img2.imgtp.com/2024/02/16/hzuvhaWq.jpg',
'https://p.sda1.dev/15/9c05c42c06e02f8228004b3ce45e0dbf/736461.png',
'https://p.sda1.dev/15/c63b2d777eb3487d2930e44ee957d30e/1287141.png',
'https://p.sda1.dev/15/48906ee01df78782f7da44fbd19c9e08/shanxi.jpg',
'https://p.sda1.dev/15/d76f3bbf1e230e6540e979aaca11bad9/微信图片_20231214191032.jpg',
'https://p.sda1.dev/15/7823c5d5b590c9cd078c1a7ed1523908/fj.png'
],//随机选取一张图片 todo
}
11 changes: 8 additions & 3 deletions emailHtml.js

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const {
type,
startDay,
imgs,
moneyRange
moneyRange,
marryDay
} = require('./config');

async function init() {
Expand Down Expand Up @@ -57,19 +58,20 @@ async function init() {
const moneyRate = Math.random();
const word = `【约会基金】:范方出资 ${(money * moneyRate).toFixed(2)} 元,钱方出资 ${(money * (1 - moneyRate)).toFixed(2)} 元,共 ${money} 元。`;
console.log(`🥩 此次约会基金===>[${word}]`)
const img = imgs[getRandom(0, imgs.length - 1)];
console.log(`🍉 此次的图片为[${img}]`)
const temp = await fetch(img);
const tempData = await temp.arrayBuffer();
const imgurl = `data:image/${getImgeName(img)};base64,${Buffer.from(tempData, 'binary').toString('base64')}`;
// 计算日期
const lovingDays = dayjs(dayjs().tz('Asia/Shanghai')).diff(
startDay,
'days'
);
console.log('===♥️lovingDays===', lovingDays)
console.log('===🛩️ lovingDays===', lovingDays)

const mD = dayjs(dayjs().tz('Asia/Shanghai')).diff(
marryDay,
'days'
);
console.log('===🥠 marryDays===', mD)
// 用邮件模版生成字符串
const htmlStr = emailHtml(weatherData, lifeData, word, imgurl, lovingDays);
const htmlStr = emailHtml(weatherData, lifeData, word, lovingDays,mD);
// 发送邮件; 本人的话一个月发一次邮件 定于每月12号发送邮件
to.forEach(p => {
if (p === masterAccount && dayjs().date() == 12) {
Expand Down

0 comments on commit e3d4c2d

Please sign in to comment.