Skip to content

Commit

Permalink
Merge pull request #166 from wangxinleo/feature/develop
Browse files Browse the repository at this point in the history
feat(wechat-public-account-push): 增加休息日提醒
  • Loading branch information
wangxinleo authored Sep 15, 2022
2 parents daa44a8 + eb06094 commit bbbaceb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ node ./main.js
| \* wind_direction.DATA | 风向 | 持续东南风 |
| \* wind_scale.DATA | 风级 | <3级 |

**节假日**
| 参数 | 详细 | 示例 |
|------------------------|----------------|----------------|
| holidaytts.DATA | 下一休息日综合提醒 | 还有3天就周六了,好好工作吧!距离国庆还有18天,早着呢 |

**每日N句**

| 参数 | 详细 | 示例 |
Expand Down
18 changes: 18 additions & 0 deletions src/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,21 @@ export const getCIBA = async () => {
return {}
}

/**
* 获取下一休息日tts
* @returns
*/
export const getHolidaytts = async () => {
const url = 'https://wangxinleo.cn/api/wx-push/holiday/getHolidaytts'
const res = await axios.get(url).catch(err => err)

if (res.status === 200 && res.data && res.data.code === 0) {
return res.data.tts
}
console.error('获取下一休息日tts: 发生错误', res)
return null
}

/**
* 每日一言
* @param {*} type
Expand Down Expand Up @@ -556,6 +571,8 @@ export const getAggregatedData = async () => {
content: noteEn = DEFAULT_OUTPUT.noteEn,
note: noteCh = DEFAULT_OUTPUT.noteCh
} = await getCIBA()
// 获取下一休息日
const holidaytts = await getHolidaytts() || DEFAULT_OUTPUT.holidaytts
// 获取每日一言
const {
hitokoto: oneTalk = DEFAULT_OUTPUT.oneTalk,
Expand Down Expand Up @@ -626,6 +643,7 @@ export const getAggregatedData = async () => {
{ name: toLowerLine('birthdayMessage'), value: birthdayMessage, color: getColor() },
{ name: toLowerLine('noteEn'), value: noteEn, color: getColor() },
{ name: toLowerLine('noteCh'), value: noteCh, color: getColor() },
{ name: toLowerLine('holidaytts'), value: holidaytts, color: getColor() },
{ name: toLowerLine('oneTalk'), value: oneTalk, color: getColor() },
{ name: toLowerLine('talkFrom'), value: talkFrom, color: getColor() },
{ name: toLowerLine('earthyLoveWords'), value: earthyLoveWords, color: getColor() },
Expand Down
1 change: 1 addition & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const DEFAULT_OUTPUT = {
minTemperature: '想你的温度℃',
windDirection: '朝向你',
windScale: '100级哦',
holidaytts: '嘿嘿,今天不告诉你~'
}

export const CITY_INFO = {
Expand Down

0 comments on commit bbbaceb

Please sign in to comment.