京东赚赚脚本(jd_jdzz.js)更新,优化宠汪汪赛跑脚本通知

This commit is contained in:
lxk0301
2020-12-20 17:22:30 +08:00
parent f5e63ba4c9
commit 54f78881c1
6 changed files with 73 additions and 40 deletions

View File

@ -105,7 +105,7 @@ cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scrip
# 京东健康 # 京东健康
cron "3 8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdh.js,tag=京东健康 cron "3 8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdh.js,tag=京东健康
# 京东赚赚 # 京东赚赚
cron "10 10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdzz.js, tag=京东赚赚 cron "10 11 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdzz.js, tag=京东赚赚
# 京东秒杀红包雨 # 京东秒杀红包雨
cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ms_redrain.js, tag=秒杀红包雨 cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ms_redrain.js, tag=秒杀红包雨

View File

@ -33,7 +33,7 @@
"40 9,10 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_watch.js, tag=京东看一看, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_watch.png", "40 9,10 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_watch.js, tag=京东看一看, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_watch.png",
"10-20/5 12 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live.js, tag=京东直播, img-url= https://raw.githubusercontent.com/58xinian/icon/master/jd_live_redrain.png", "10-20/5 12 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live.js, tag=京东直播, img-url= https://raw.githubusercontent.com/58xinian/icon/master/jd_live_redrain.png",
"10 8 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdh.js, tag=京东健康, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_jdh.png", "10 8 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdh.js, tag=京东健康, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_jdh.png",
"10 8 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdzz.js, tag=京东赚赚, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdzz.png", "14 11 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdzz.js, tag=京东赚赚, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdzz.png",
"1 0,20,9-23/2 15-31 12 * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live_redrain.js, tag=直播红包雨, img-url= https://raw.githubusercontent.com/58xinian/icon/master/jd_live_redrain.png", "1 0,20,9-23/2 15-31 12 * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live_redrain.js, tag=直播红包雨, img-url= https://raw.githubusercontent.com/58xinian/icon/master/jd_live_redrain.png",
"10 12 1-31 12 * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jr_sign.js, tag=京东金融打卡, img-url= https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png", "10 12 1-31 12 * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jr_sign.js, tag=京东金融打卡, img-url= https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png",
"15 17 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, tag=小米运动, img-url=https://raw.githubusercontent.com/58xinian/icon/master/xmyd.png" "15 17 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, tag=小米运动, img-url=https://raw.githubusercontent.com/58xinian/icon/master/xmyd.png"

View File

@ -68,7 +68,7 @@ cron "40 9,10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_sc
#京东健康 #京东健康
cron "20 23 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdh.js, timeout=750, wake-system=1, tag=京东健康 cron "20 23 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdh.js, timeout=750, wake-system=1, tag=京东健康
#京东赚赚 #京东赚赚
cron "20 17 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdzz.js, timeout=750, wake-system=1, tag=京东赚赚 cron "20 11 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdzz.js, timeout=750, wake-system=1, tag=京东赚赚
#以下为短期活动 #以下为短期活动
#金融打卡领年终奖 #金融打卡领年终奖
cron "30 7 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jr_sign.js, timeout=750, wake-system=1, tag=金融打卡领年终奖 cron "30 7 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jr_sign.js, timeout=750, wake-system=1, tag=金融打卡领年终奖

View File

@ -46,8 +46,8 @@ if ($.isNode()) {
const JD_API_HOST = 'https://api.m.jd.com/'; const JD_API_HOST = 'https://api.m.jd.com/';
!(async () => { !(async () => {
$.newShareCodes = [] $.newShareCodes = []
await getAuthorShareCode(); // await getAuthorShareCode();
await getAuthorShareCode2(); // await getAuthorShareCode2();
if (!cookiesArr[0]) { if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
return; return;
@ -75,34 +75,34 @@ const JD_API_HOST = 'https://api.m.jd.com/';
await jdBeanHome(); await jdBeanHome();
} }
} }
for (let i = 0; i < cookiesArr.length; i++) { // for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) { // if (cookiesArr[i]) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]) // $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
console.log(`${$.UserName}去帮助下一个人`) // console.log(`${$.UserName}去帮助下一个人`)
cookie = cookiesArr[i]; // cookie = cookiesArr[i];
if ($.newShareCodes.length > 1) { // if ($.newShareCodes.length > 1) {
let code = $.newShareCodes[(i + 1) % $.newShareCodes.length] // let code = $.newShareCodes[(i + 1) % $.newShareCodes.length]
await help(code[0], code[1]) // await help(code[0], code[1])
} // }
if (helpAuthor && $.authorCode) { // if (helpAuthor && $.authorCode) {
console.log(`去帮助作者`) // console.log(`去帮助作者`)
const helpRes = await help($.authorCode[0], $.authorCode[1]) // const helpRes = await help($.authorCode[0], $.authorCode[1])
if (helpRes && helpRes.data.respCode === 'SG209') { // if (helpRes && helpRes.data.respCode === 'SG209') {
console.log(`助力次数已耗尽,跳出助力`) // console.log(`助力次数已耗尽,跳出助力`)
break; // break;
} // }
} // }
if (helpAuthor && $.authorCode2) { // if (helpAuthor && $.authorCode2) {
for (let code of $.authorCode2) { // for (let code of $.authorCode2) {
const helpRes = await help(code.shareCode, code.groupCode); // const helpRes = await help(code.shareCode, code.groupCode);
if (helpRes && helpRes.data.respCode === 'SG209') { // if (helpRes && helpRes.data.respCode === 'SG209') {
console.log(`助力次数已耗尽,跳出助力`) // console.log(`助力次数已耗尽,跳出助力`)
break; // break;
} // }
} // }
} // }
} // }
} // }
})() })()
.catch((e) => { .catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '') $.log('', `${$.name}, 失败! 原因: ${e}!`, '')

View File

@ -25,6 +25,7 @@ const notify = $.isNode() ? require('./sendNotify') : '';
//Node.js用户请在jdCookie.js处填写京东ck; //Node.js用户请在jdCookie.js处填写京东ck;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
let helpAuthor=true; // 帮助作者 let helpAuthor=true; // 帮助作者
const randomCount = 5;
let jdNotify = true; // 是否关闭通知false打开通知推送true关闭通知推送 let jdNotify = true; // 是否关闭通知false打开通知推送true关闭通知推送
//IOS等用户直接用NobyDa的jd cookie //IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '', message; let cookiesArr = [], cookie = '', message;
@ -51,6 +52,7 @@ const inviteCodes = [
$.tuanList = [] $.tuanList = []
await requireConfig(); await requireConfig();
if (helpAuthor) await getAuthorShareCode('https://gitee.com/shylocks/updateTeam/raw/main/jd_zz.json'); if (helpAuthor) await getAuthorShareCode('https://gitee.com/shylocks/updateTeam/raw/main/jd_zz.json');
if (helpAuthor) await getAuthorShareCode('https://gitee.com/lxk0301/updateTeam/raw/master/jd_zz.json');
if (!cookiesArr[0]) { if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
return; return;
@ -173,7 +175,7 @@ function helpFriendTuan(body) {
if (data.resultCode === '9200008') console.log('不能助力自己') if (data.resultCode === '9200008') console.log('不能助力自己')
else if (data.resultCode === '9200011') console.log('已经助力过') else if (data.resultCode === '9200011') console.log('已经助力过')
else if (data.resultCode === '2400205') console.log('团已满') else if (data.resultCode === '2400205') console.log('团已满')
else if (data.resultCode === '2400203') {console.log('助力次数已');$.canHelp = false} else if (data.resultCode === '2400203') {console.log('助力次数已耗尽');$.canHelp = false}
else console.log(`未知错误`) else console.log(`未知错误`)
} }
} }
@ -329,7 +331,30 @@ async function helpFriends() {
await doTask({"itemId": code, "taskId": "3", "mpVersion": "3.1.0"}, "doHelpTask") await doTask({"itemId": code, "taskId": "3", "mpVersion": "3.1.0"}, "doHelpTask")
} }
} }
function readShareCode() {
console.log(`开始`)
return new Promise(async resolve => {
$.get({url: `https://code.chiang.fun/api/v1/jd/jdzz/read/${randomCount}/`}, (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (data) {
console.log(`随机取${randomCount}个码放到您固定的互助码后面`)
data = JSON.parse(data);
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
await $.wait(10000);
resolve()
})
}
//格式化助力码 //格式化助力码
function shareCodesFormat() { function shareCodesFormat() {
return new Promise(async resolve => { return new Promise(async resolve => {
@ -342,7 +367,7 @@ function shareCodesFormat() {
const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1); const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
$.newShareCodes = inviteCodes[tempIndex].split('@'); $.newShareCodes = inviteCodes[tempIndex].split('@');
} }
const readShareCodeRes = null //await readShareCode(); const readShareCodeRes = await readShareCode();
if (readShareCodeRes && readShareCodeRes.code === 200) { if (readShareCodeRes && readShareCodeRes.code === 200) {
$.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])]; $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
} }
@ -355,7 +380,8 @@ function requireConfig() {
return new Promise(resolve => { return new Promise(resolve => {
console.log(`开始获取${$.name}配置文件\n`); console.log(`开始获取${$.name}配置文件\n`);
//Node.js用户请在jdCookie.js处填写京东ck; //Node.js用户请在jdCookie.js处填写京东ck;
const shareCodes = [] //$.isNode() ? require('./jdSplitShareCodes.js') : ''; // TODO 互助
const shareCodes = [];
console.log(`${cookiesArr.length}个京东账号\n`); console.log(`${cookiesArr.length}个京东账号\n`);
$.shareCodesArr = []; $.shareCodesArr = [];
if ($.isNode()) { if ($.isNode()) {

File diff suppressed because one or more lines are too long