yyds 2022-02-18 18:56:29 +08:00
parent bf694e2d0b
commit 2de75e1b35
1 changed files with 47 additions and 18 deletions

View File

@ -25,11 +25,8 @@ cron "5 6-18/6 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/maste
jd免费水果 搬的https://github.com/liuxiaoyucc/jd-helper/blob/a6f275d9785748014fc6cca821e58427162e9336/fruit/fruit.js jd免费水果 搬的https://github.com/liuxiaoyucc/jd-helper/blob/a6f275d9785748014fc6cca821e58427162e9336/fruit/fruit.js
*/ */
const $ = new Env('东东农场_内部互助'); const $ = new Env('东东农场_内部互助');
let cookiesArr = [], cookie = '', isBox = false, notify,allMessage = ''; let cookiesArr = [], cookie = '', jdFruitShareArr = [], notify, allMessage = '';
//助力好友分享码(最多3个,否则后面的助力失败),原因:京东农场每人每天只有3次助力机会 //助力好友分享码(最多3个,否则后面的助力失败),原因:京东农场每人每天只有3次助力机会
//此此内容是IOS用户下载脚本到本地使用填写互助码的地方同一京东账号的好友互助码请使用@符号隔开。
//下面给出两个账号的填写示例iOS只支持2个京东账号
let newShareCodes=[]; let newShareCodes=[];
let message = '', subTitle = '', option = {}, isFruitFinished = false; let message = '', subTitle = '', option = {}, isFruitFinished = false;
const retainWater = $.isNode() ? (process.env.retainWater ? process.env.retainWater : 100) : ($.getdata('retainWater') ? $.getdata('retainWater') : 100);//保留水滴大于多少g,默认100g; const retainWater = $.isNode() ? (process.env.retainWater ? process.env.retainWater : 100) : ($.getdata('retainWater') ? $.getdata('retainWater') : 100);//保留水滴大于多少g,默认100g;
@ -90,6 +87,7 @@ const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%2
subTitle = ''; subTitle = '';
option = {}; option = {};
$.retry = 0; $.retry = 0;
await shareCodesFormat();
await jdFruit(); await jdFruit();
} }
} }
@ -103,6 +101,25 @@ const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%2
.finally(() => { .finally(() => {
$.done(); $.done();
}) })
function shareCodesFormat() {
return new Promise(async resolve => {
console.log(`${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
newShareCodes = [];
if ($.shareCodesArr[$.index - 1]) {
newShareCodes = $.shareCodesArr[$.index - 1].split('@');
} else {
const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
newShareCodes = shareCodes[tempIndex].split('@');
}
if ($.isNode() && !process.env.FRUITSHARECODES) {
console.log(`您未填写助力码变量优先进行账号内互助再帮【zero205】助力`);
newShareCodes = [...(jdFruitShareArr || []), ...(newShareCodes || [])]
}
console.log(`${$.index}个京东账号将要助力的好友${JSON.stringify(newShareCodes)}`)
resolve();
})
}
async function jdFruit() { async function jdFruit() {
subTitle = `【京东账号${$.index}${$.nickName || $.UserName}`; subTitle = `【京东账号${$.index}${$.nickName || $.UserName}`;
try { try {
@ -1000,10 +1017,10 @@ async function GetCollect() {
await initForFarm(); await initForFarm();
if ($.farmInfo.farmUserPro) { if ($.farmInfo.farmUserPro) {
console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}好友互助码】${$.farmInfo.farmUserPro.shareCode}`); console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}好友互助码】${$.farmInfo.farmUserPro.shareCode}`);
newShareCodes.push($.farmInfo.farmUserPro.shareCode) jdFruitShareArr.push($.farmInfo.farmUserPro.shareCode)
} else { } else {
console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}好友互助码】\n数据异常,使用ccwav的互助码:f910ae66879a422daeb32f9250fc5e2e`); console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}好友互助码】\n数据异常,使用ccwav的互助码:f910ae66879a422daeb32f9250fc5e2e`);
newShareCodes.push("f910ae66879a422daeb32f9250fc5e2e"); jdFruitShareArr.push("f910ae66879a422daeb32f9250fc5e2e");
} }
} catch (e) { } catch (e) {
$.logErr(e); $.logErr(e);
@ -1339,6 +1356,7 @@ function requireConfig() {
notify = $.isNode() ? require('./sendNotify') : ''; 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') : '';
const jdFruitShareCodes = $.isNode() ? require('./jdFruitShareCodes.js') : '';
//IOS等用户直接用NobyDa的jd cookie //IOS等用户直接用NobyDa的jd cookie
if ($.isNode()) { if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => { Object.keys(jdCookieNode).forEach((item) => {
@ -1352,6 +1370,17 @@ function requireConfig() {
} }
console.log(`${cookiesArr.length}个京东账号\n`) console.log(`${cookiesArr.length}个京东账号\n`)
$.shareCodesArr = []; $.shareCodesArr = [];
if ($.isNode()) {
Object.keys(jdFruitShareCodes).forEach((item) => {
if (jdFruitShareCodes[item]) {
$.shareCodesArr.push(jdFruitShareCodes[item])
}
})
} else {
if ($.getdata('FRUITSHARECODES')) $.shareCodesArr = $.getdata('FRUITSHARECODES').split('\n').filter(item => !!item);
console.log(`\nBoxJs设置的${$.name}好友邀请码:${$.getdata('FRUITSHARECODES') ? $.getdata('FRUITSHARECODES') : '暂无'}\n`);
}
console.log(`您提供了${$.shareCodesArr.length}个账号的农场助力码\n`);
resolve() resolve()
}) })
} }