mirror of
https://github.com/lan-tianxiang/clone_scripts.git
synced 2026-03-31 08:59:45 +08:00
更新于 08-01 11:04
This commit is contained in:
104
jd_pet.js
104
jd_pet.js
@@ -31,13 +31,15 @@ let cookiesArr = [], cookie = '', jdPetShareArr = [], isBox = false, notify, new
|
||||
//下面给出两个账号的填写示例(iOS只支持2个京东账号)
|
||||
let shareCodes = [ // IOS本地脚本用户这个列表填入你要助力的好友的shareCode
|
||||
//账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
|
||||
//'MTAxODc2NTEzNTAwMDAwMDAwMjg3MDg2MA==@MTAxODc2NTEzMzAwMDAwMDAyNzUwMDA4MQ==@MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODc2NTEzNDAwMDAwMDAzMDI2MDI4MQ==@MTAxODcxOTI2NTAwMDAwMDAxOTQ3MjkzMw==@MTAxODc2NTEzMDAwMDAwMDAxMzgwNTcyNw==@MTAxODc2NTEzMzAwMDAwMDAxMzgwNDg3OQ==@MTE1NDAxNzcwMDAwMDAwMzUxNDMwMDc=@MTE1NDQ5MzYwMDAwMDAwMzUxNDMwMTE=@MTE1NDUwMTI0MDAwMDAwMDM2OTQ2Mjk1@MTAxODc2NTEzMjAwMDAwMDAyMDUxMDY2OQ==',
|
||||
//账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
|
||||
//'MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODcxOTI2NTAwMDAwMDAyNjA4ODQyMQ==@MTAxODc2NTEzOTAwMDAwMDAyNzE2MDY2NQ==@MTE1NDUyMjEwMDAwMDAwNDI0MDM2MDc=@MTAxODc2NTEzMjAwMDAwMDAwNDA5MzAzMw==@MTAxODc2NTEzMDAwMDAwMDAxMzgwNTcyNw==@MTAxODc2NTEzMzAwMDAwMDAxMzgwNDg3OQ==@MTE1NDAxNzcwMDAwMDAwMzUxNDMwMDc=@MTE1NDQ5MzYwMDAwMDAwMzUxNDMwMTE=@MTE1NDUwMTI0MDAwMDAwMDM2OTQ2Mjk1@MTAxODc2NTEzMjAwMDAwMDAyMDUxMDY2OQ==',
|
||||
]
|
||||
let message = '', subTitle = '', option = {};
|
||||
let jdNotify = false;//是否关闭通知,false打开通知推送,true关闭通知推送
|
||||
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
||||
let goodsUrl = '', taskInfoKey = [];
|
||||
let randomCount = $.isNode() ? 20 : 5;
|
||||
let randomCount = $.isNode() ? 0 : 0;
|
||||
!(async () => {
|
||||
await requireConfig();
|
||||
if (!cookiesArr[0]) {
|
||||
@@ -134,14 +136,16 @@ async function jdPet() {
|
||||
await energyCollect();//收集好感度
|
||||
await showMsg();
|
||||
console.log('全部任务完成, 如果帮助到您可以点下🌟STAR鼓励我一下, 明天见~');
|
||||
} else if (initPetTownRes.code === '0'){
|
||||
console.log(`初始化萌宠失败: ${initPetTownRes.message}`);
|
||||
} else {
|
||||
console.log(`等待10秒后重试`);
|
||||
await $.wait(10000);
|
||||
await jdPet();
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e)
|
||||
const errMsg = `京东账号${$.index} ${$.nickName || $.UserName}\n任务执行异常,请检查执行日志 ‼️‼️`;
|
||||
if ($.isNode()) await notify.sendNotify(`${$.name}`, errMsg);
|
||||
$.msg($.name, '', `${errMsg}`)
|
||||
// const errMsg = `京东账号${$.index} ${$.nickName || $.UserName}\n任务执行异常,请检查执行日志 ‼️‼️`;
|
||||
// if ($.isNode()) await notify.sendNotify(`${$.name}`, errMsg);
|
||||
// $.msg($.name, '', `${errMsg}`)
|
||||
}
|
||||
}
|
||||
// 收取所有好感度
|
||||
@@ -439,7 +443,7 @@ async function showMsg() {
|
||||
}
|
||||
// jdNotify = `${notify.petNotifyControl}` === 'false' && `${jdNotify}` === 'false' && $.getdata('jdPetNotify') === 'false';
|
||||
if ($.ctrTemp) {
|
||||
$.msg($.name, subTitle, message, option);
|
||||
// $.msg($.name, subTitle, message, option);
|
||||
if ($.isNode()) {
|
||||
allMessage += `${subTitle}\n${message}${$.index !== cookiesArr.length ? '\n\n' : ''}`
|
||||
// await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `${subTitle}\n${message}`);
|
||||
@@ -448,29 +452,53 @@ async function showMsg() {
|
||||
$.log(`\n${message}\n`);
|
||||
}
|
||||
}
|
||||
function readShareCode() {
|
||||
return new Promise(async resolve => {
|
||||
$.get({url: `http://share.turinglabs.net/api/v3/pet/query/${randomCount}/`, 'timeout': 10000}, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`)
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
await $.wait(10000);
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
// function readShareCode() {
|
||||
// return new Promise(async resolve => {
|
||||
// $.get({url: `http://www.helpu.cf/jdcodes/getcode.php?type=pet&num=${randomCount}`, 'timeout': 10000}, (err, resp, data) => {
|
||||
// try {
|
||||
// if (err) {
|
||||
// console.log(`${JSON.stringify(err)}`)
|
||||
// console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
// } else {
|
||||
// if (data) {
|
||||
// console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`)
|
||||
// data = JSON.parse(data);
|
||||
// }
|
||||
// }
|
||||
// } catch (e) {
|
||||
// $.logErr(e, resp)
|
||||
// } finally {
|
||||
// resolve(data);
|
||||
// }
|
||||
// })
|
||||
// await $.wait(10000);
|
||||
// resolve()
|
||||
// })
|
||||
// }
|
||||
//提交互助码
|
||||
// function submitCode() {
|
||||
// return new Promise(async resolve => {
|
||||
// $.get({url: `http://www.helpu.cf/jdcodes/submit.php?code=${$.petInfo.shareCode}&type=pet`, timeout: 10000}, (err, resp, data) => {
|
||||
// try {
|
||||
// if (err) {
|
||||
// console.log(`${JSON.stringify(err)}`)
|
||||
// console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
// } else {
|
||||
// if (data) {
|
||||
// //console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`)
|
||||
// data = JSON.parse(data);
|
||||
// }
|
||||
// }
|
||||
// } catch (e) {
|
||||
// $.logErr(e, resp)
|
||||
// } finally {
|
||||
// resolve(data);
|
||||
// }
|
||||
// })
|
||||
// await $.wait(15000);
|
||||
// resolve()
|
||||
// })
|
||||
// }
|
||||
function shareCodesFormat() {
|
||||
return new Promise(async resolve => {
|
||||
// console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
|
||||
@@ -482,14 +510,12 @@ function shareCodesFormat() {
|
||||
const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
|
||||
newShareCodes = shareCodes[tempIndex].split('@');
|
||||
}
|
||||
/*
|
||||
//因好友助力功能下线。故暂时屏蔽
|
||||
const readShareCodeRes = await readShareCode();
|
||||
//const readShareCodeRes = null;
|
||||
if (readShareCodeRes && readShareCodeRes.code === 200) {
|
||||
newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
|
||||
}
|
||||
*/
|
||||
// const readShareCodeRes = await readShareCode();
|
||||
// //const readShareCodeRes = null;
|
||||
// if (readShareCodeRes && readShareCodeRes.code === 200) {
|
||||
// newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
|
||||
// }
|
||||
console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify(newShareCodes)}`)
|
||||
resolve();
|
||||
})
|
||||
@@ -521,8 +547,8 @@ function requireConfig() {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if ($.getdata('jd_pet_inviter')) $.shareCodesArr = $.getdata('jd_pet_inviter').split('\n').filter(item => !!item);
|
||||
console.log(`\nBoxJs设置的${$.name}好友邀请码:${$.getdata('jd_pet_inviter') ? $.getdata('jd_pet_inviter') : '暂无'}\n`);
|
||||
if ($.getdata('PETSHARECODES')) $.shareCodesArr = $.getdata('PETSHARECODES').split('\n').filter(item => !!item);
|
||||
console.log(`\nBoxJs设置的${$.name}好友邀请码:${$.getdata('PETSHARECODES') ? $.getdata('PETSHARECODES') : '暂无'}\n`);
|
||||
}
|
||||
// console.log(`$.shareCodesArr::${JSON.stringify($.shareCodesArr)}`)
|
||||
// console.log(`jdPetShareArr账号长度::${$.shareCodesArr.length}`)
|
||||
|
||||
Reference in New Issue
Block a user