From fed764b4af21a8ac8ca7a4701b14b7948eb27705 Mon Sep 17 00:00:00 2001
From: guyuexuan <2651919937@qq.com>
Date: Mon, 25 Jan 2021 16:12:20 +0800
Subject: [PATCH 1/2] =?UTF-8?q?[=E9=9B=86=E9=9E=AD=E7=82=AE=E8=B5=A2?=
=?UTF-8?q?=E4=BA=AC=E8=B1=86]=20=E6=96=B0=E5=A2=9E=20=E6=BB=A1=E8=B6=B3?=
=?UTF-8?q?=E5=85=91=E6=8D=A2=20FIRECRACKERS=5FNOTITY=5FBEAN=20=E4=B8=AA?=
=?UTF-8?q?=E4=BA=AC=E8=B1=86=E6=97=B6=E8=BF=9B=E8=A1=8C=20notify=20?=
=?UTF-8?q?=E9=80=9A=E7=9F=A5=20=E6=96=B0=E5=A2=9E=20=E9=BB=91=E5=8F=B7?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=B7=B3=E8=BF=87=E4=BB=BB=E5=8A=A1=E6=89=A7?=
=?UTF-8?q?=E8=A1=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
jd_firecrackers.js | 57 ++++++++++++++++++++++++++++++++++------------
1 file changed, 42 insertions(+), 15 deletions(-)
diff --git a/jd_firecrackers.js b/jd_firecrackers.js
index d5a67b79..7fef4878 100644
--- a/jd_firecrackers.js
+++ b/jd_firecrackers.js
@@ -26,6 +26,7 @@ cron "10 8,21 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_sc
*/
const $ = new Env('集鞭炮赢京豆');
const notify = $.isNode() ? require('./sendNotify') : '';
+let notifyBean = $.isNode() ? process.env.FIRECRACKERS_NOTITY_BEAN || 0 : 0; // 账号满足兑换多少京豆时提示 默认 0 不提示,格式:120 表示能兑换 120 豆子发出通知;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
//Node.js用户请在jdCookie.js处填写京东ck;
//IOS等用户直接用NobyDa的jd cookie
@@ -92,9 +93,25 @@ async function jdFamily() {
}
function showMsg() {
- return new Promise(resolve => {
- message += `本次运行获得鞭炮${$.earn},共计${$.total}🧨`
- $.log($.name, '', `京东账号${$.index}${$.nickName}\n${message}`);
+ return new Promise(async resolve => {
+ subTitle = `【京东账号${$.index}】${$.nickName}`;
+ message += `【鞭炮🧨】本次获得 ${$.earn},共计${$.total}\n`
+ if ($.total && notifyBean) {
+ for (let item of $.prize) {
+ if (notifyBean >= item.beansPerNum) { // 符合预定的京豆档位
+ if ($.total >= item.prizerank) { // 当前鞭炮满足兑换
+ message += `【京豆】请手动兑换 ${item.beansPerNum} 个京豆,需消耗花费🧨 ${item.prizerank}`
+ $.msg($.name, subTitle, message);
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `${subTitle}\n${message}`);
+ resolve();
+ return;
+ }
+ }
+ }
+ }
+ }
+ $.log(`${$.name}\n\n账号${$.index} - ${$.nickName}\n${subTitle}\n${message}`);
resolve()
})
}
@@ -130,17 +147,22 @@ function getUserInfo(info = false) {
$.userInfo = JSON.parse(data.match(/query\((.*)\n/)[1])
if (info) {
$.earn = $.userInfo.tatalprofits - $.total
- } else for (let task of $.info.config.tasks) {
- let vo = $.userInfo.tasklist.filter(vo => vo.taskid === task['_id'])
- if (vo.length > 0) {
- vo = vo[0]
- if (vo['isdo'] === 1) {
- if (vo['times'] === 0) {
- console.log(`去做任务${task['_id']}`)
- await doTask(task['_id'])
- await $.wait(3000)
- } else {
- console.log(`${Math.trunc(vo['times'] / 60)}分钟可后做任务${task['_id']}`)
+ } else {
+ for (let task of $.info.config.tasks) {
+ let vo = $.userInfo.tasklist.filter(vo => vo.taskid === task['_id'])
+ if (vo.length > 0) {
+ vo = vo[0]
+ if (vo['isdo'] === 1) {
+ if (vo['times'] === 0) {
+ console.log(`去做任务${task['_id']}`)
+ let res = await doTask(task['_id'])
+ if (!res) { // 黑号,不再继续执行任务
+ break;
+ }
+ await $.wait(3000)
+ } else {
+ console.log(`${Math.trunc(vo['times'] / 60)}分钟可后做任务${task['_id']}`)
+ }
}
}
}
@@ -165,9 +187,14 @@ function doTask(taskId) {
console.log(`${err},${jsonParse(resp.body)['message']}`)
console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
- data = JSON.parse(data.match(/query\((.*)\n/)[1])
+ let res = data.match(/query\((.*)\n/)[1];
+ data = JSON.parse(res);
if (data.ret === 0) {
console.log(`任务完成成功`)
+ } else if (data.ret === 1001) {
+ console.log(`任务完成失败,原因:这个账号黑号了!!!`)
+ resolve(false);
+ return;
} else {
console.log(`任务完成失败,原因未知`)
}
From acfa379a996987919da71ebb3f6e3ed32864de24 Mon Sep 17 00:00:00 2001
From: guyuexuan <2651919937@qq.com>
Date: Mon, 25 Jan 2021 16:15:40 +0800
Subject: [PATCH 2/2] =?UTF-8?q?[=E9=9B=86=E9=9E=AD=E7=82=AE=E8=B5=A2?=
=?UTF-8?q?=E4=BA=AC=E8=B1=86]=20=E6=96=B0=E5=A2=9E=E7=8E=AF=E5=A2=83?=
=?UTF-8?q?=E5=8F=98=E9=87=8F=E8=AF=B4=E6=98=8E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
githubAction.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/githubAction.md b/githubAction.md
index 3d6d675d..6bcb8ea3 100644
--- a/githubAction.md
+++ b/githubAction.md
@@ -86,6 +86,7 @@
| `JD_WECHAT_USER_AGENT` | 京东炸年兽
小程序
自定义UA | 非必须 | 强烈推荐使用自定义的小程序UA防止黑号,UA示例:
Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15A148 MicroMessenger/7.0.20(0x17001320) NetType/WIFI Language/zh_CN |
| `DREAMFACTORY_FORBID_ACCOUNT`| 京喜工厂
控制哪个京东账号不运行此脚本 | 非必须 | 输入`1`代表第一个京东账号不运行,多个使用`&`连接,例:`1&3`代表账号1和账号3不运行京喜工厂脚本,注:输入`0`,代表全部账号不运行京喜工厂脚本 |
| `JDFACTORY_FORBID_ACCOUNT`| 东东工厂
控制哪个京东账号不运行此脚本 | 非必须 | 输入`1`代表第一个京东账号不运行,多个使用`&`连接,例:`1&3`代表账号1和账号3不运行东东工厂脚本,注:输入`0`,代表全部账号不运行东东工厂脚本 |
+| `FIRECRACKERS_NOTITY_BEAN`| 集鞭炮赢京豆
满足兑换 X 个京豆通知开关 | 非必须 | 默认 0 不通知,输入 120 表示满足兑换 120 个京豆时通知 |
##### 互助码的填写规则