From 29282cf478cbc8af948a7225ec8dd57af67510dd Mon Sep 17 00:00:00 2001 From: noone <26899964+xxxXXX95@users.noreply.github.com> Date: Wed, 23 Mar 2022 10:19:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20server=E9=85=B1api=E6=9B=B4=E6=96=B0=20(?= =?UTF-8?q?#42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: meooxx <13815865+meooxx@users.noreply.github.com> --- jobs.js | 4 ++-- tools.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jobs.js b/jobs.js index 3fa8acb..d598937 100644 --- a/jobs.js +++ b/jobs.js @@ -75,7 +75,7 @@ async function submitOrderFromItemDetailPage( await helper.submitOrder(skuId).then(async r => { console.log(r); if (r.success) { - await helper.sendToWechat(r); + await helper.sendToWechat(r, true); process.exit(); } if (i === concurrency) { @@ -373,7 +373,7 @@ async function submitOrderFromShoppingCart( now ).format('YYYY-MM-DD HH:mm:ss.SSS')}`; console.log(text); - await helper.sendToWechat(text); + await helper.sendToWechat(text, true); return true; } else { if (res.noStockSkuIds) { diff --git a/tools.js b/tools.js index 5e51e39..d0ac36b 100644 --- a/tools.js +++ b/tools.js @@ -583,12 +583,12 @@ class Tools { return {}; } }; - sendToWechat = message => { + sendToWechat = async (message, success) => { if (!message) return; if (!config.messenger) return; - const url = `http://sc.ftqq.com/${this.config.sckey}.send`; + const url = `https://sctapi.ftqq.com/${this.config.sckey}.send`; const payload = { - text: '抢购结果', + title: success ? '抢购成功✅' : '抢购失败❌', desp: message }; return this.request(url + `?${qs.stringify(payload)}`);