iOS端BoxJs支持多个账号的东东农场、东东萌宠、种豆得豆的邀请码填写。不兼容以前的设置。

This commit is contained in:
lxk0301
2021-04-09 09:41:01 +08:00
parent 6776c9bcdd
commit 9fc1a416eb
5 changed files with 65 additions and 338 deletions

View File

@@ -1,6 +1,6 @@
/*
东东水果:脚本更新地址 https://gitee.com/lxk0301/jd_scripts/raw/master/jd_fruit.js
更新时间2021-2-27
更新时间2021-4-9
活动入口京东APP我的-更多工具-东东农场
东东农场活动链接https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html
已支持IOS双京东账号,Node.js支持N个京东账号
@@ -1274,10 +1274,10 @@ function readShareCode() {
}
function shareCodesFormat() {
return new Promise(async resolve => {
// console.log(`第${$.index}个京东账号的助力码:::${jdFruitShareArr[$.index - 1]}`)
// console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
newShareCodes = [];
if (jdFruitShareArr[$.index - 1]) {
newShareCodes = jdFruitShareArr[$.index - 1].split('@');
if ($.shareCodesArr[$.index - 1]) {
newShareCodes = $.shareCodesArr[$.index - 1].split('@');
} else {
console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
@@ -1311,46 +1311,20 @@ function requireConfig() {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
}
console.log(`${cookiesArr.length}个京东账号\n`)
$.shareCodesArr = [];
if ($.isNode()) {
Object.keys(jdFruitShareCodes).forEach((item) => {
if (jdFruitShareCodes[item]) {
jdFruitShareArr.push(jdFruitShareCodes[item])
$.shareCodesArr.push(jdFruitShareCodes[item])
}
})
} else {
const boxShareCodeArr = ['jd_fruit1', 'jd_fruit2', 'jd_fruit3', 'jd_fruit4'];
const boxShareCodeArr2 = ['jd2_fruit1', 'jd2_fruit2', 'jd2_fruit3', 'jd2_fruit4'];
const isBox1 = boxShareCodeArr.some((item) => {
const boxShareCode = $.getdata(item);
return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
});
const isBox2 = boxShareCodeArr2.some((item) => {
const boxShareCode = $.getdata(item);
return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
});
isBox = isBox1 ? isBox1 : isBox2;
if (isBox1) {
let temp = [];
for (const item of boxShareCodeArr) {
if ($.getdata(item)) {
temp.push($.getdata(item))
}
}
jdFruitShareArr.push(temp.join('@'));
}
if (isBox2) {
let temp = [];
for (const item of boxShareCodeArr2) {
if ($.getdata(item)) {
temp.push($.getdata(item))
}
}
jdFruitShareArr.push(temp.join('@'));
}
if ($.getdata('jd_fruit_inviter')) $.shareCodesArr = $.getdata('jd_fruit_inviter').split('\n').filter(item => !!item);
console.log(`\nBoxJs设置的${$.name}好友邀请码:${$.getdata('jd_fruit_inviter')}\n`);
}
// console.log(`jdFruitShareArr::${JSON.stringify(jdFruitShareArr)}`)
// console.log(`jdFruitShareArr账号长度::${jdFruitShareArr.length}`)
console.log(`您提供了${jdFruitShareArr.length}个账号的农场助力码\n`);
// console.log(`$.shareCodesArr::${JSON.stringify($.shareCodesArr)}`)
// console.log(`jdFruitShareArr账号长度::${$.shareCodesArr.length}`)
console.log(`您提供了${$.shareCodesArr.length}个账号的农场助力码\n`);
resolve()
})
}