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]) {
@ -70,15 +71,18 @@ const inviteCodes = [];
} }
//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++) {
lnrun++;
cookie = cookiesArr[i]; 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(`\n【京东账号${$.index}${$.UserName})开始助力好友】\n`)
console.log(`格式化后的助力码::${JSON.stringify(inviteCodes)}\n`); console.log(`格式化后的助力码::${JSON.stringify(inviteCodes)}\n`);
for (let code of inviteCodes) { for (let code of inviteCodes) {
if (!code) continue if (!code) continue
@ -88,6 +92,11 @@ const inviteCodes = [];
break break
} }
} }
if (lnrun == 5) {
console.log(`\n【访问接口次数达到5次休息一分钟.....】\n`);
await $.wait(60 * 1000);
lnrun = 0;
}
} }
})() })()
.catch((e) => { .catch((e) => {

View File

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