KingRan 2022-02-24 18:09:04 +08:00
parent 4b3874c860
commit 93f8d7db1e
2 changed files with 25 additions and 15 deletions

View File

@ -24,7 +24,7 @@ cron "50 4,17 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/
============小火箭========= ============小火箭=========
东东工厂 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_jdfactory_help.js, cronexpr="50 4,17 * * *", timeout=3600, enable=true 东东工厂 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_jdfactory_help.js, cronexpr="50 4,17 * * *", timeout=3600, enable=true
*/ */
const $ = new Env('东东工厂内部互助互助'); const $ = new Env('东东工厂内部互助');
const notify = $.isNode() ? require('./sendNotify') : ''; 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') : '';
@ -44,6 +44,7 @@ if ($.isNode()) {
let wantProduct = ``;//心仪商品名称 let wantProduct = ``;//心仪商品名称
const JD_API_HOST = 'https://api.m.jd.com/client.action'; const JD_API_HOST = 'https://api.m.jd.com/client.action';
const inviteCodes = []; const inviteCodes = [];
let lnrun = 0;
!(async () => { !(async () => {
await requireConfig(); await requireConfig();
if (!cookiesArr[0]) { if (!cookiesArr[0]) {
@ -69,25 +70,33 @@ const inviteCodes = [];
continue continue
} }
//await shareCodesFormat(); //await shareCodesFormat();
await jdFactory() await jdFactory()
await $.wait(1500);
} }
} }
console.log(`\n开始账号内互助\n`); console.log(`\n开始账号内互助\n`);
for (let i = 0; i < cookiesArr.length; i++) { for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i]; lnrun++;
cookie = cookiesArr[i];
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
console.log('开始助力好友') $.isLogin = true;
$.nickName = '';
console.log(`格式化后的助力码::${JSON.stringify(inviteCodes)}\n`); console.log(`\n【京东账号${$.index}${$.UserName})开始助力好友】\n`)
for (let code of inviteCodes) { console.log(`格式化后的助力码::${JSON.stringify(inviteCodes)}\n`);
if (!code) continue for (let code of inviteCodes) {
const helpRes = await jdfactory_collectScore(code); if (!code) continue
if (helpRes.code === 0 && helpRes.data.bizCode === -7) { const helpRes = await jdfactory_collectScore(code);
console.log(`助力机会已耗尽,跳出`); if (helpRes.code === 0 && helpRes.data.bizCode === -7) {
break console.log(`助力机会已耗尽,跳出`);
break
} }
} }
if (lnrun == 5) {
console.log(`\n【访问接口次数达到5次休息一分钟.....】\n`);
await $.wait(60 * 1000);
lnrun = 0;
}
} }
})() })()
.catch((e) => { .catch((e) => {

View File

@ -115,7 +115,8 @@ console.log(`共${cookiesArr.length}个京东账号\n`);
goodsUrl = ''; goodsUrl = '';
taskInfoKey = []; taskInfoKey = [];
option = {}; option = {};
await jdPet(); lnrun++;
await jdPet();
if (lnrun == 3) { if (lnrun == 3) {
console.log(`\n【访问接口次数达到3次休息一分钟.....】\n`); console.log(`\n【访问接口次数达到3次休息一分钟.....】\n`);
await $.wait(60 * 1000); await $.wait(60 * 1000);