diff --git a/.github/workflows/weixin.yml b/.github/workflows/weixin.yml
index aedd1f0..1b50978 100644
--- a/.github/workflows/weixin.yml
+++ b/.github/workflows/weixin.yml
@@ -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:
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d91ac72
--- /dev/null
+++ b/LICENSE
@@ -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.
diff --git a/README.md b/README.md
index 5b86401..a4385ec 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ npm i
node index.js
```
-可以部署到coding开启自动化构建,以达到每天定时发送消息的效果。
+可以部署到coding开启自动化构建,以达到每天定时发送消息的效果。参考:https://www.coolapk.com/feed/51238147?shareKey=Zjk0N2UwZTFjNjcwNjU3YThjNjg~&shareUid=1528711&shareFrom=com.coolapk.market_13.2.1
可以使用GitHub Actions以达到每日自动发送消息,默认发送时间为七点半。
config.json配置说明:
@@ -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",
diff --git a/index.js b/index.js
index 30af024..ba6418c 100644
--- a/index.js
+++ b/index.js
@@ -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');
@@ -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文件是否填写正确')
}