From 9d1308bdc1add008b476b654519e932d927dfa6a Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 9 Apr 2021 11:33:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E5=AE=8C=E6=88=90=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E5=88=A0=E9=99=A4=E4=B8=8B=E8=BD=BD=E7=9A=84?= =?UTF-8?q?JD=5FDailyBonus.js=E6=96=87=E4=BB=B6=E3=80=82=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BA=BA=E4=B8=8B=E6=AC=A1=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E7=94=B1=E4=BA=8E=E7=BD=91=E7=BB=9C=E5=BC=82=E5=B8=B8=E4=B8=8B?= =?UTF-8?q?=E8=BD=BDJD=5FDailyBonus.js=E6=96=87=E4=BB=B6=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=AD=BE=E5=88=B0=E4=B8=AD=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_bean_sign.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/jd_bean_sign.js b/jd_bean_sign.js index 29b650ec..7fe32ba0 100644 --- a/jd_bean_sign.js +++ b/jd_bean_sign.js @@ -6,7 +6,7 @@ 活动入口:各处的签到汇总 Node.JS专用 IOS软件用户请使用 https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js -更新时间:2021-3-27 +更新时间:2021-4-9 推送通知默认简洁模式(多账号只发送一次)。如需详细通知,设置环境变量 JD_BEAN_SIGN_NOTIFY_SIMPLE 为false即可(N账号推送N次通知)。 Modified From github https://github.com/ruicky/jd_sign_bot */ @@ -56,7 +56,7 @@ if ($.isNode()) { await execSign(); } } - await deleteFile(JD_DailyBonusPath);//删除下载的JD_DailyBonus.js文件 + //await deleteFile(JD_DailyBonusPath);//删除下载的JD_DailyBonus.js文件 if ($.isNode() && allMessage && process.env.JD_BEAN_SIGN_NOTIFY_SIMPLE === 'true') { await notify.sendNotify(`${$.name}`, `${allMessage}`) } @@ -109,20 +109,13 @@ async function execSign() { } //运行完成后,删除下载的文件 await deleteFile(resultPath);//删除result.txt - console.log(`\n\n*****************京东账号${$.index} ${$.nickName || $.UserName}京豆签到完成*******************\n\n`); + console.log(`\n\n*****************${new Date(new Date().getTime()).toLocaleString()} 京东账号${$.index} ${$.nickName || $.UserName}京豆签到完成*******************\n\n`); } catch (e) { console.log("京东签到脚本执行异常:" + e); } } async function downFile () { let url = ''; - // if (process.env.CDN_JD_DAILYBONUS) { - // url = 'https://cdn.jsdelivr.net/gh/NobyDa/Script@master/JD-DailyBonus/JD_DailyBonus.js'; - // } else if (process.env.JD_COOKIE) { - // url = 'https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js'; - // } else { - // url = 'https://cdn.jsdelivr.net/gh/NobyDa/Script@master/JD-DailyBonus/JD_DailyBonus.js'; - // } await downloadUrl(); if ($.body) { url = 'https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js'; @@ -152,7 +145,7 @@ async function downFile () { async function changeFile (content) { console.log(`开始替换变量`) - let newContent = content.replace(/var Key = ''/, `var Key = '${cookie}'`); + let newContent = content.replace(/var Key = '.*'/, `var Key = '${cookie}'`); newContent = newContent.replace(/const NodeSet = 'CookieSet.json'/, `const NodeSet = '${NodeSet}'`) if (process.env.JD_BEAN_STOP && process.env.JD_BEAN_STOP !== '0') { newContent = newContent.replace(/var stop = '0'/, `var stop = '${process.env.JD_BEAN_STOP}'`); @@ -245,7 +238,13 @@ function downloadUrl(url = 'https://raw.githubusercontent.com/NobyDa/Script/mast console.log(`检测到您当前网络环境不能访问外网,将使用jsdelivr CDN下载JD_DailyBonus.js文件`); await $.http.get({url: `https://purge.jsdelivr.net/gh/NobyDa/Script@master/JD-DailyBonus/JD_DailyBonus.js`, timeout: 10000}).then((resp) => { if (resp.statusCode === 200) { - console.log(`JD_DailyBonus.js文件jsdelivr CDN缓存刷新成功`) + let { body } = resp; + body = JSON.parse(body); + if (body['success']) { + console.log(`JD_DailyBonus.js文件 CDN刷新成功`) + } else { + console.log(`JD_DailyBonus.js文件 CDN刷新失败`) + } } }); } else {