From 3ac8a87879eb10071a2f058ab71484ade98542a4 Mon Sep 17 00:00:00 2001 From: "Aaron.Twan" <488698112@qq.com> Date: Mon, 21 Mar 2022 10:03:40 +0800 Subject: [PATCH 1/3] Update checkin.yml --- .github/workflows/checkin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checkin.yml b/.github/workflows/checkin.yml index 8a791660..a08d219b 100644 --- a/.github/workflows/checkin.yml +++ b/.github/workflows/checkin.yml @@ -2,7 +2,7 @@ name: CheckIn on: schedule: - - cron: "40 22 * * *" # 北京时间上午06:40 + - cron: "10 4 * * *" # 北京时间上午12:10 workflow_dispatch: jobs: CheckIn: From acaf492d4b2ce34aa8406d153a938a77e952805d Mon Sep 17 00:00:00 2001 From: djf-p <488698112@qq.com> Date: Sat, 2 Apr 2022 16:02:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=92=89=E9=92=89?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/checkin.yml | 1 + .github/workflows/seaGold.yml | 1 + README.md | 1 + scripts/checkin.js | 1 + scripts/seaGold.js | 1 + scripts/utils/env.js | 3 ++- scripts/utils/utils.js | 20 ++++++++++++++++++++ 7 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checkin.yml b/.github/workflows/checkin.yml index a08d219b..f7d35ea1 100644 --- a/.github/workflows/checkin.yml +++ b/.github/workflows/checkin.yml @@ -16,6 +16,7 @@ jobs: EMAIL_USER: ${{ secrets.EMAIL_USER }} EMAIL_PASS: ${{ secrets.EMAIL_PASS }} EMAIL_TO: ${{ secrets.EMAIL_TO }} + DINGDING_WEBHOOK: ${{ secrets.DINGDING_WEBHOOK }} run: | yarn yarn checkin diff --git a/.github/workflows/seaGold.yml b/.github/workflows/seaGold.yml index c9d87123..6a6ac87c 100644 --- a/.github/workflows/seaGold.yml +++ b/.github/workflows/seaGold.yml @@ -16,6 +16,7 @@ jobs: EMAIL_USER: ${{ secrets.EMAIL_USER }} EMAIL_PASS: ${{ secrets.EMAIL_PASS }} EMAIL_TO: ${{ secrets.EMAIL_TO }} + DINGDING_WEBHOOK: ${{ secrets.DINGDING_WEBHOOK }} run: | yarn yarn seaGold diff --git a/README.md b/README.md index a2a3f01d..b7fd59bc 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ | Name | Value | | --- | --- | | COOKIE | 掘金网站Cookie, 打开浏览器,登录 [掘金](https://juejin.cn/), 打开控制台DevTools -> Network,复制 cookie, **掘金Cookie有效期约1个月需定期更新.** | + | DINGDING_WEBHOOK | 钉钉机器人WEBHOOK | | EMAIL_USER | 发件人邮箱地址(需要开启 SMTP) | | EMAIL_PASS | 发件人邮箱密码(SMTP密码) | | EMAIL_TO | 订阅人邮箱地址(收件人). 如需多人订阅使用 `, ` 分割, 例如: `a@163.com, b@qq.com` | diff --git a/scripts/checkin.js b/scripts/checkin.js index 588af57f..d4972f98 100644 --- a/scripts/checkin.js +++ b/scripts/checkin.js @@ -179,6 +179,7 @@ async function run(args) { subject: "掘金每日签到", text: content }); + utils.dingding(content); } run(process.argv.splice(2)).catch(error => { diff --git a/scripts/seaGold.js b/scripts/seaGold.js index 4d581b7a..a5807d19 100644 --- a/scripts/seaGold.js +++ b/scripts/seaGold.js @@ -406,6 +406,7 @@ async function run(args) { subject: "海底掘金游戏", text: content }); + utils.dingding(content); } run(process.argv.splice(2)).catch(error => { diff --git a/scripts/utils/env.js b/scripts/utils/env.js index 2e98bcb7..8cd33079 100644 --- a/scripts/utils/env.js +++ b/scripts/utils/env.js @@ -4,5 +4,6 @@ module.exports = { EMAIL_USER: env.EMAIL_USER, EMAIL_PASS: env.EMAIL_PASS, EMAIL_TO: env.EMAIL_TO, - COOKIE: env.COOKIE + COOKIE: env.COOKIE, + DINGDING_WEBHOOK:env.DINGDING_WEBHOOK }; diff --git a/scripts/utils/utils.js b/scripts/utils/utils.js index 2fafe4b2..19d4d159 100644 --- a/scripts/utils/utils.js +++ b/scripts/utils/utils.js @@ -1,8 +1,28 @@ +const env = require("./env"); +const fetch = require('node-fetch') module.exports = { async wait(time = 0) { return new Promise(resolve => setTimeout(resolve, time)); }, randomRangeNumber(start = 500, end = 1000) { return (Math.random() * (end - start) + start) >> 0; + }, + dingding(msg) { + DINGDING_WEBHOOK = env.DINGDING_WEBHOOK + if (typeof DINGDING_WEBHOOK != "undefined" && DINGDING_WEBHOOK != null && DINGDING_WEBHOOK != "" && DINGDING_WEBHOOK != undefined) { + data = { + "msgtype": "text", + "text": { + "content": msg + } + } + fetch(DINGDING_WEBHOOK, { + headers: { + "Content-Type": "application/json", "Charset": "UTF-8" + }, + method: "POST", + body: JSON.stringify(data) + }).then(res => console.log(JSON.stringify(res))) + } } } From 5bb823f14f027f30ad3b7d7aec8efb83ba7128fe Mon Sep 17 00:00:00 2001 From: Derek Li Date: Fri, 8 Apr 2022 17:29:04 +0800 Subject: [PATCH 3/3] Update checkin.yml --- .github/workflows/checkin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checkin.yml b/.github/workflows/checkin.yml index f7d35ea1..d5ba0ac4 100644 --- a/.github/workflows/checkin.yml +++ b/.github/workflows/checkin.yml @@ -2,7 +2,7 @@ name: CheckIn on: schedule: - - cron: "10 4 * * *" # 北京时间上午12:10 + - cron: "40 22 * * *" # 北京时间上午06:40 workflow_dispatch: jobs: CheckIn: