Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/weixin.yml
#	README.md
  • Loading branch information
lengsukq committed Jan 15, 2024
2 parents 5c33d42 + b201a06 commit c833907
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/weixin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
pull_request:
branches: [ "master" ]
schedule:
- cron: '30 23 * * *' # 每天23:30执行,时间为国际标准时间,换算成北京时间为7:30
- cron: '30 23 * * *' # 每天23:30执行,时间为国际标准时间,换算成北京时间为7:30,由于git执行的是国际视角,所以若为八点之前时间都会提前一天,请修改json时间或者把自动运行时间设定为八点之后

jobs:
build:
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 lengsukq

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ npm i
node index.js
```

可以部署到coding开启自动化构建,以达到每天定时发送消息的效果。<br>
可以部署到coding开启自动化构建,以达到每天定时发送消息的效果。参考:https://www.coolapk.com/feed/51238147?shareKey=Zjk0N2UwZTFjNjcwNjU3YThjNjg~&shareUid=1528711&shareFrom=com.coolapk.market_13.2.1<br>
可以使用GitHub Actions以达到每日自动发送消息,默认发送时间为七点半。

config.json配置说明:
Expand All @@ -22,9 +22,9 @@ config.json配置说明:
"name2": "2", // 推送用户2
"birthday": "2000-01-01", // 推送用户1的生日 只支持输入农历
"birthday2": "2000-01-01",// 推送用户2的生日 只支持输入农历
"key": "70add67deb8d8d33", // 和风天气Key获取,https://id.qweather.com/#/
// 以下数据获取:http://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index
"key": "70add67deb8d8d33",
"appId": "wxc56b9022",
"appSecret": "96b89bc360ae7315febfbbd",
"templateId": "OSoSPbyNdUIeVm3nV5pptiC8GrwCXzk",
Expand Down
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ const formatDate = (birthday, isYear = false) => {
// console.log('isYear---',isYear)
let inYear = isYear ? today.add(1, 'year') : today
let BirthdayYear = solarlunar.lunar2solar(inYear.year(), dayjs(birthday).month() + 1, dayjs(birthday).date());
// console.log('formatDate',birthday,BirthdayYear,dayjs(birthday).month()+1,dayjs(birthday).date())

let month = BirthdayYear.cMonth;
let day = BirthdayYear.cDay;
// console.log('formatDate',BirthdayYear,birthday,month,day)

month = Number(month) < 10 ? '0' + month : month;
day = Number(day < 10) ? '0' + day : day;
let formatTime = inYear.year() + '-' + month + '-' + day;
let formatTime = BirthdayYear.cYear + '-' + month + '-' + day;
const formattedDate = today.format("YYYY-MM-DD");
let diffVal = dayjs(today).diff(formatTime, 'day');

Expand Down Expand Up @@ -52,7 +53,8 @@ const basicInfo = async () => {
configs.memorialDay = dayjs(today).diff(configs.fullInLoveDate, 'day');
configs.memorialSecond = dayjs(today).diff(configs.fullInLoveDate, 'second');
configs.birthdayDiff = getDiffVal(configs.birthday);
configs.birthdayDiff2 = getDiffVal(configs.birthday2)
configs.birthdayDiff2 = getDiffVal(configs.birthday2);
// console.log('birthdayDiff2',configs.birthdayDiff2)
} catch (err) {
console.log('请检查JSON文件是否填写正确')
}
Expand Down

0 comments on commit c833907

Please sign in to comment.