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_pet.js
更新时间2021-02-27
更新时间2021-04-9
活动入口京东APP我的-更多工具-东东萌宠
已支持IOS双京东账号,Node.js支持N个京东账号
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
@@ -475,10 +475,10 @@ function readShareCode() {
}
function shareCodesFormat() {
return new Promise(async resolve => {
// console.log(`第${$.index}个京东账号的助力码:::${jdPetShareArr[$.index - 1]}`)
// console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
newShareCodes = [];
if (jdPetShareArr[$.index - 1]) {
newShareCodes = jdPetShareArr[$.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);
@@ -513,46 +513,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(jdPetShareCodes).forEach((item) => {
if (jdPetShareCodes[item]) {
jdPetShareArr.push(jdPetShareCodes[item])
$.shareCodesArr.push(jdPetShareCodes[item])
}
})
} else {
const boxShareCodeArr = ['jd_pet1', 'jd_pet2', 'jd_pet3', 'jd_pet4', 'jd_pet5'];
const boxShareCodeArr2 = ['jd2_pet1', 'jd2_pet2', 'jd2_pet3', 'jd2_pet4', 'jd2_pet5'];
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))
}
}
jdPetShareArr.push(temp.join('@'));
}
if (isBox2) {
let temp = [];
for (const item of boxShareCodeArr2) {
if ($.getdata(item)) {
temp.push($.getdata(item))
}
}
jdPetShareArr.push(temp.join('@'));
}
if ($.getdata('jd_pet_inviter')) $.shareCodesArr = $.getdata('jd_pet_inviter').split('\n').filter(item => !!item);
console.log(`\nBoxJs设置的${$.name}好友邀请码:${$.getdata('jd_pet_inviter')}\n`);
}
// console.log(`jdPetShareArr::${JSON.stringify(jdPetShareArr)}`)
// console.log(`jdPetShareArr账号长度::${jdPetShareArr.length}`)
console.log(`您提供了${jdPetShareArr.length}个账号的东东萌宠助力码\n`);
// console.log(`$.shareCodesArr::${JSON.stringify($.shareCodesArr)}`)
// console.log(`jdPetShareArr账号长度::${$.shareCodesArr.length}`)
console.log(`您提供了${$.shareCodesArr.length}个账号的东东萌宠助力码\n`);
resolve()
})
}