Merge pull request #1 from lxk0301/master

merge
This commit is contained in:
Akira
2020-12-11 13:22:58 +08:00
committed by GitHub
11 changed files with 615 additions and 53 deletions

View File

@@ -122,7 +122,10 @@ cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scrip
cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ms_redrain.js, tag=秒杀红包雨 cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ms_redrain.js, tag=秒杀红包雨
# 金榜年终奖 # 金榜年终奖
cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_split.js,tag=年终奖 cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_split.js, tag=年终奖
# PUBG # PUBG
cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pubg.js,tag=PUBG cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pubg.js, tag=PUBG
# 京东直播
cron "10-20/5 12 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live.js, tag=京东直播

View File

@@ -33,6 +33,7 @@
"0 0,9,11,13,15,17,19,20,21,23 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live_redrain.js, tag=直播红包雨, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png", "0 0,9,11,13,15,17,19,20,21,23 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live_redrain.js, tag=直播红包雨, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png",
"10 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_apple_live.js, tag=苹果抽奖机, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png", "10 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_apple_live.js, tag=苹果抽奖机, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png",
"10 1 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pubg.js, tag=PUBG, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png", "10 1 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pubg.js, tag=PUBG, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png",
"10-20/5 12 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live.js, tag=京东直播, img-url= https://raw.githubusercontent.com/58xinian/icon/master/jd_live_redrain.png",
"15 17 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, tag=小米运动, img-url=https://raw.githubusercontent.com/58xinian/icon/master/xmyd.png" "15 17 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, tag=小米运动, img-url=https://raw.githubusercontent.com/58xinian/icon/master/xmyd.png"
] ]
} }

View File

@@ -84,3 +84,5 @@
33 2 * * * node /scripts/jd_car.js >> /scripts/logs/jd_car.log 2>&1 33 2 * * * node /scripts/jd_car.js >> /scripts/logs/jd_car.log 2>&1
# 领京豆额外奖励(每日可获得3京豆) # 领京豆额外奖励(每日可获得3京豆)
33 4 * * * node /scripts/jd_bean_home.js >> /scripts/logs/jd_bean_home.log 2>&1 33 4 * * * node /scripts/jd_bean_home.js >> /scripts/logs/jd_bean_home.log 2>&1
# 京东直播(每日18豆)
10-20/5 11 * * * node /scripts/jd_live.js >> /scripts/logs/jd_live.log 2>&1

View File

@@ -84,3 +84,5 @@
33 2 * * * node /scripts/jd_car.js |ts >> /scripts/logs/jd_car.log 2>&1 33 2 * * * node /scripts/jd_car.js |ts >> /scripts/logs/jd_car.log 2>&1
# 领京豆额外奖励(每日可获得3京豆) # 领京豆额外奖励(每日可获得3京豆)
33 4 * * * node /scripts/jd_bean_home.js |ts >> /scripts/logs/jd_bean_home.log 2>&1 33 4 * * * node /scripts/jd_bean_home.js |ts >> /scripts/logs/jd_bean_home.log 2>&1
# 京东直播(每日18豆)
10-20/5 11 * * * node /scripts/jd_live.js |ts >> /scripts/logs/jd_live.log 2>&1

View File

@@ -1,5 +1,6 @@
/* /*
领京豆额外奖励 领京豆额外奖励&抢京豆
脚本自带助力码,介意者可将 29行 helpAuthor 变量设置为 false
入口:首页-领京豆 入口:首页-领京豆
更新地址https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_home.js 更新地址https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_home.js
已支持IOS双京东账号, Node.js支持N个京东账号 已支持IOS双京东账号, Node.js支持N个京东账号
@@ -25,7 +26,7 @@ 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') : '';
let jdNotify = true;//是否关闭通知false打开通知推送true关闭通知推送 let jdNotify = true;//是否关闭通知false打开通知推送true关闭通知推送
const randomCount = $.isNode() ? 20 : 5; const helpAuthor = true; // 是否帮助作者助力false打开通知推送true关闭通知推送
//IOS等用户直接用NobyDa的jd cookie //IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '', message; let cookiesArr = [], cookie = '', message;
if ($.isNode()) { if ($.isNode()) {
@@ -39,6 +40,8 @@ if ($.isNode()) {
} }
const JD_API_HOST = 'https://api.m.jd.com/'; const JD_API_HOST = 'https://api.m.jd.com/';
!(async () => { !(async () => {
$.newShareCodes = []
await getAuthorShareCode()
if (!cookiesArr[0]) { if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
return; return;
@@ -66,6 +69,21 @@ const JD_API_HOST = 'https://api.m.jd.com/';
await jdBeanHome(); await jdBeanHome();
} }
} }
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
console.log(`${$.UserName}去帮助下一个人`)
cookie = cookiesArr[i];
if ($.newShareCodes.length > 1) {
let code = $.newShareCodes[(i + 1) % $.newShareCodes.length]
await help(code[0], code[1])
}
if (helpAuthor && $.authorCode) {
console.log(`去帮助作者`)
await help($.authorCode[0], $.authorCode[1])
}
}
}
})() })()
.catch((e) => { .catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '') $.log('', `${$.name}, 失败! 原因: ${e}!`, '')
@@ -75,10 +93,131 @@ const JD_API_HOST = 'https://api.m.jd.com/';
}) })
async function jdBeanHome() { async function jdBeanHome() {
await getUserInfo()
await getTaskList() await getTaskList()
await showMsg(); await showMsg();
} }
function getAuthorShareCode() {
return new Promise(resolve => {
$.get({url: "https://cdn.jsdelivr.net/gh/shylocks/updateTeam@main/jd_bean_home"}, async (err, resp, data) => {
try {
if (err) {
} else {
$.authorCode = data.replace('\n', '').split(' ')
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function getUserInfo() {
return new Promise(resolve => {
$.post(taskUrl('signBeanGroupStageIndex', 'body'), async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
$.actId = data.data.jklInfo.keyId
let {shareCode, groupCode} = data.data
if (!shareCode) {
console.log(`未获取到助力码,去开团`)
await hitGroup()
} else {
console.log(shareCode, groupCode)
// 去做逛会场任务
if (data.data.beanActivityVisitVenue.taskStatus === '0') {
await help(shareCode, groupCode, 1)
}
$.newShareCodes.push([shareCode, groupCode])
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function hitGroup() {
return new Promise(resolve => {
const body = {"activeType": 2,};
$.get(taskGetUrl('signGroupHit', body), async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.data.respCode === "SG150") {
let {shareCode, groupCode} = data.data.signGroupMain
if (shareCode) {
$.newShareCodes.push([shareCode, groupCode])
console.log('开团成功')
await help(shareCode, groupCode, 1)
} else {
console.log(`为获取到助力码,错误信息${JSON.stringify(data.data)}`)
}
} else {
console.log(`开团失败,错误信息${JSON.stringify(data.data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function help(shareCode, groupCode, isTask = 0) {
return new Promise(resolve => {
const body = {
"activeType": 2,
"groupCode": groupCode,
"shareCode": shareCode,
"activeId": $.actId,
};
if (isTask) {
console.log(`【抢京豆】做任务获取助力`)
body['isTask'] = "1"
} else {
console.log(`【抢京豆】去助力好友${shareCode}`)
body['source'] = "guest"
}
$.get(taskGetUrl('signGroupHelp', body), async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`【抢京豆】${$.name} API请求失败请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
console.log(`【抢京豆】${data.data.helpToast}`)
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function showMsg() { function showMsg() {
return new Promise(resolve => { return new Promise(resolve => {
$.msg($.name, '', `【京东账号${$.index}${$.nickName}\n${message}`); $.msg($.name, '', `【京东账号${$.index}${$.nickName}\n${message}`);
@@ -135,8 +274,7 @@ function receiveTask(itemId = "zddd", type = "3") {
data = JSON.parse(data); data = JSON.parse(data);
if (data.data) { if (data.data) {
console.log(`完成任务成功,进度${data.data.taskProgress}/${data.data.taskThreshold}`) console.log(`完成任务成功,进度${data.data.taskProgress}/${data.data.taskThreshold}`)
} } else {
else{
console.log(`完成任务失败,${data.errorMessage}`) console.log(`完成任务失败,${data.errorMessage}`)
} }
} }
@@ -180,6 +318,23 @@ function award() {
}) })
} }
function taskGetUrl(function_id, body) {
return {
url: `${JD_API_HOST}client.action?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld&clientVersion=9.2.0`,
headers: {
'Cookie': cookie,
'Host': 'api.m.jd.com',
'Accept': '*/*',
'Connection': 'keep-alive',
'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
'Accept-Encoding': 'gzip, deflate, br',
'Content-Type': "application/x-www-form-urlencoded"
}
}
}
function taskUrl(function_id, body) { function taskUrl(function_id, body) {
body["version"] = "9.0.0.1"; body["version"] = "9.0.0.1";
body["monitor_source"] = "plant_app_plant_index"; body["monitor_source"] = "plant_app_plant_index";

View File

@@ -281,7 +281,8 @@ function shareCodesFormat() {
}) })
} }
function requireConfig() { function requireConfig() {
return new Promise(resolve => { return new Promise(async resolve => {
await getAuthorShareCode()
console.log(`开始获取${$.name}配置文件\n`); console.log(`开始获取${$.name}配置文件\n`);
//Node.js用户请在jdCookie.js处填写京东ck; //Node.js用户请在jdCookie.js处填写京东ck;
const shareCodes = [] //$.isNode() ? require('./jdSplitShareCodes.js') : ''; const shareCodes = [] //$.isNode() ? require('./jdSplitShareCodes.js') : '';
@@ -298,6 +299,22 @@ function requireConfig() {
resolve() resolve()
}) })
} }
function getAuthorShareCode() {
return new Promise(resolve => {
$.get({url: "https://cdn.jsdelivr.net/gh/shylocks/updateTeam@main/jd_digital_floor"}, async (err, resp, data) => {
try {
if (err) {
} else {
inviteCodes[0] = data.replace('\n', '')
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function taskPostUrl(function_id, body) { function taskPostUrl(function_id, body) {
return { return {
url: `${JD_API_HOST}${function_id}?t=${new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000}`, url: `${JD_API_HOST}${function_id}?t=${new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000}`,

View File

@@ -131,12 +131,12 @@ async function joinTwoPeopleRun() {
joyRunFlag = process.env.JOY_RUN_FLAG; joyRunFlag = process.env.JOY_RUN_FLAG;
} }
if (`${joyRunFlag}` === 'true') { if (`${joyRunFlag}` === 'true') {
console.log(`\n===========以下是双人赛跑信息========\n`) teamLevel = $.isNode() ? (process.env.JOY_TEAM_LEVEL ? process.env.JOY_TEAM_LEVEL : teamLevel) : ($.getdata('JOY_TEAM_LEVEL') ? $.getdata('JOY_TEAM_LEVEL') : teamLevel);
console.log(`\n===========以下是${teamLevel}人赛跑信息========\n`)
await getPetRace(); await getPetRace();
if ($.petRaceResult) { if ($.petRaceResult) {
teamLevel = $.isNode() ? (process.env.JOY_TEAM_LEVEL ? process.env.JOY_TEAM_LEVEL : teamLevel) : ($.getdata('JOY_TEAM_LEVEL') ? $.getdata('JOY_TEAM_LEVEL') : teamLevel);
let petRaceResult = $.petRaceResult.data.petRaceResult; let petRaceResult = $.petRaceResult.data.petRaceResult;
let raceUsers = $.petRaceResult.data.raceUsers; // let raceUsers = $.petRaceResult.data.raceUsers;
console.log(`赛跑状态:${petRaceResult}\n`); console.log(`赛跑状态:${petRaceResult}\n`);
if (petRaceResult === 'not_participate') { if (petRaceResult === 'not_participate') {
console.log(`暂未参赛,现在为您参加${teamLevel}人赛跑`); console.log(`暂未参赛,现在为您参加${teamLevel}人赛跑`);
@@ -146,7 +146,8 @@ async function joinTwoPeopleRun() {
message += `${teamLevel}人赛跑:成功参加\n`; message += `${teamLevel}人赛跑:成功参加\n`;
await getPetRace(); await getPetRace();
petRaceResult = $.petRaceResult.data.petRaceResult; petRaceResult = $.petRaceResult.data.petRaceResult;
raceUsers = $.petRaceResult.data.raceUsers; await getRankList();
// raceUsers = $.petRaceResult.data.raceUsers;
// console.log(`参赛后的状态:${petRaceResult}`) // console.log(`参赛后的状态:${petRaceResult}`)
console.log(`双人赛跑助力请自己手动去邀请好友,脚本不带赛跑助力功能\n`); console.log(`双人赛跑助力请自己手动去邀请好友,脚本不带赛跑助力功能\n`);
} }
@@ -172,25 +173,26 @@ async function joinTwoPeopleRun() {
} }
} }
if (petRaceResult === 'participate') { if (petRaceResult === 'participate') {
if(raceUsers) { await getRankList();
for (let index =0; index < raceUsers.length; index++) { if($.raceUsers && $.raceUsers.length > 0) {
if (raceUsers[index].myself) { for (let index = 0; index < $.raceUsers.length; index++) {
console.log(`您当前里程:${raceUsers[index].distance}KM\n`); if (index === 0) {
message += `您当前里程:${raceUsers[index].distance}km\n`; console.log(`您当前里程:${$.raceUsers[index].distance}KM\n当前排名:第${$.raceUsers[index].rank}\n将获得积分:${$.raceUsers[index].coin}\n`);
// message += `您当前里程:${$.raceUsers[index].distance}km\n`;
} else { } else {
console.log(`对手当前里程:${raceUsers[index].distance}KM\n`); console.log(`对手当前里程:${$.raceUsers[index].distance}KM`);
message += `对手当前里程:${raceUsers[index].distance}km\n`; // message += `对手当前里程:${$.raceUsers[index].distance}km\n`;
} }
} }
} }
console.log('今日已参赛,下面显示应援团信息\n'); console.log('\n今日已参赛,下面显示应援团信息');
await getBackupInfo(); await getBackupInfo();
if ($.getBackupInfoResult.success) { if ($.getBackupInfoResult.success) {
const { currentNickName, totalMembers, totalDistance, backupList } = $.getBackupInfoResult.data; const { currentNickName, totalMembers, totalDistance, backupList } = $.getBackupInfoResult.data;
console.log(`${currentNickName}的应援团信息如下\n团员:${totalMembers}\n团员助力的里程数:${totalDistance}\n`); console.log(`${currentNickName}的应援团信息如下\n团员:${totalMembers}\n团员助力的里程数:${totalDistance}\n`);
if (backupList && backupList.length > 0) { if (backupList && backupList.length > 0) {
for (let item of backupList) { for (let item of backupList) {
console.log(`${item.nickName}为您助力${item.distance}km\n`); console.log(`${item.nickName}为您助力${item.distance}km`);
} }
} else { } else {
console.log(`暂无好友为您助力赛跑,如需助力,请手动去邀请好友助力\n`); console.log(`暂无好友为您助力赛跑,如需助力,请手动去邀请好友助力\n`);
@@ -610,6 +612,30 @@ function getPetRace() {
}) })
}) })
} }
//查询赛跑排行榜
function getRankList() {
return new Promise(resolve => {
const url = `${JD_API_HOST}/combat/getRankList`;
$.raceUsers = [];
$.get(taskUrl(url, `jdjoy.jd.com`, 'h5'), (err, resp, data) => {
try {
if (err) {
console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
} else {
// console.log('查询赛跑信息API',(data))
data = JSON.parse(data);
if (data.success) {
$.raceUsers = data.datas;
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
})
})
}
//参加赛跑API //参加赛跑API
function runMatch(teamLevel, timeout = 5000) { function runMatch(teamLevel, timeout = 5000) {
if (teamLevel === 10 || teamLevel === 50) timeout = 60000; if (teamLevel === 10 || teamLevel === 50) timeout = 60000;

273
jd_live.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -106,6 +106,7 @@ function getRedRain() {
let act = data.data.iconArea.filter(vo=>vo['type']==="platform_red_packege_rain")[0] let act = data.data.iconArea.filter(vo=>vo['type']==="platform_red_packege_rain")[0]
let url = act.data.activityUrl let url = act.data.activityUrl
$.activityId = url.substr(url.indexOf("id=") + 3) $.activityId = url.substr(url.indexOf("id=") + 3)
console.log($.activityId)
$.startTime = act.startTime $.startTime = act.startTime
$.endTime = act.endTime $.endTime = act.endTime
console.log(`下一场红包雨开始时间:${new Date(act.startTime)}`) console.log(`下一场红包雨开始时间:${new Date(act.startTime)}`)
@@ -160,7 +161,7 @@ function receiveRedRain() {
function taskPostUrl(function_id, body = {}) { function taskPostUrl(function_id, body = {}) {
return { return {
url: `https://api.m.jd.com/client.action?functionId=${function_id}`, url: `https://api.m.jd.com/client.action?functionId=${function_id}`,
body: 'area=12_904_908_57903&body=%7B%22liveId%22%3A%222956873%22%7D&build=167408&client=apple&clientVersion=9.2.0&d_brand=apple&d_model=iPhone10%2C2&eid=eidIF3CF0112RTIyQTVGQTEtRDVCQy00Qg%3D%3D6HAJa9%2B/4Vedgo62xKQRoAb47%2Bpyu1EQs/6971aUvk0BQAsZLyQAYeid%2BPgbJ9BQoY1RFtkLCLP5OMqU&isBackground=N&openudid=53f4d9c70c1c81f1c8769d2fe2fef0190a3f60d2&osVersion=14.2&partner=TF&rfs=0000&scope=01&screen=1242%2A2208&sign=4fefb7b802a8b1d7ae4529ec32b0bda8&st=1607470636080&sv=121&uts=0f31TVRjBSvNs/AdsIxcW3vOKTLS9m1Bkfr/wtDAnp1q%2BaUi8exzmBNoKgjayIUv6x2Kyf6ccTzo3NpoIr0XxE05GZbP8oOh2s6rmFPTTjPhnIs%2BkxDNq6jbLa/OXerurB%2BctY3Sg9OWaR6%2BnF4XsNtDZrNmKU57jtBoJWI8O2D/lA%2B%2B7sFMhxC%2BxMi9yfyM%2BT%2Bu5DbTBDJCOR1QUIScQw%3D%3D&uuid=hjudwgohxzVu96krv/T6Hg%3D%3D', body: 'area=12_904_908_57903&body=%7B%22liveId%22%3A%222997252%22%7D&build=167408&client=apple&clientVersion=9.2.0&d_brand=apple&d_model=iPhone10%2C2&eid=eidIF3CF0112RTIyQTVGQTEtRDVCQy00Qg%3D%3D6HAJa9%2B/4Vedgo62xKQRoAb47%2Bpyu1EQs/6971aUvk0BQAsZLyQAYeid%2BPgbJ9BQoY1RFtkLCLP5OMqU&isBackground=N&joycious=194&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=53f4d9c70c1c81f1c8769d2fe2fef0190a3f60d2&osVersion=14.2&partner=TF&rfs=0000&scope=01&screen=1242%2A2208&sign=706f847a6252a4fe03869b2901bb0815&st=1607643593651&sv=110&uts=0f31TVRjBSsDGINmdElmZlgBxMZQifcxhB/BdpQKugK3pigFDsPY3x%2BIXMm0vOlDa%2BujRn1irmu%2BjbgWg0C%2B9Qd9NZvImI0ZQc/fN8EoflUT3Sb6VQm0WwdM77kwyb56x3lxaqFyeh3r1KEOHCier47iIpyuyvVQVG2KbTKocIo0CS9xpYtzkQr1dLgceiIho7GvOrMiBQ%2BtyUe/1wcqtg%3D%3D&uuid=hjudwgohxzVu96krv/T6Hg%3D%3D',
headers: { headers: {
'Host': 'api.m.jd.com', 'Host': 'api.m.jd.com',
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',

View File

@@ -2,7 +2,7 @@
* @Author: lxk0301 https://github.com/lxk0301 * @Author: lxk0301 https://github.com/lxk0301
* @Date: 2020-11-12 11:42:12 * @Date: 2020-11-12 11:42:12
* @Last Modified by: lxk0301 * @Last Modified by: lxk0301
* @Last Modified time: 2020-11-23 12:27:20 * @Last Modified time: 2020-12-11 12:27:20
*/ */
/* /*
东东小窝 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js 东东小窝 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js
@@ -103,6 +103,7 @@ async function smallHome() {
await lottery(); await lottery();
await doAllTask(); await doAllTask();
await queryByUserId(); await queryByUserId();
await queryFurnituresCenterList();
await showMsg(); await showMsg();
} }
function showMsg() { function showMsg() {
@@ -118,33 +119,7 @@ async function lottery() {
console.log(`免费抽奖机会今日已使用\n`) console.log(`免费抽奖机会今日已使用\n`)
} }
} }
//获取详情
function queryByUserId() {
return new Promise(resolve => {
$.get(taskUrl(`ssjj-wo-home-info/queryByUserId/2`), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.head.code === 200) {
if (data.body) {
message += `【小窝名】${data.body.name}\n`;
message += `【当前WO币】${data.body.woB}\n`;
}
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
async function doChannelsListTask(taskId, taskType) { async function doChannelsListTask(taskId, taskType) {
await queryChannelsList(taskId); await queryChannelsList(taskId);
for (let item of $.queryChannelsList) { for (let item of $.queryChannelsList) {
@@ -270,6 +245,94 @@ async function doAllTask() {
} }
} }
} }
function queryFurnituresCenterList() {
return new Promise(resolve => {
$.get(taskUrl(`ssjj-furnitures-center/queryFurnituresCenterList`), async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.head.code === 200) {
let { buy, list } = data.body;
$.canBuyList = [];
list.map((item, index) => {
if (buy.some((buyItem) => buyItem === item.id)) return
$.canBuyList.push(item);
})
$.canBuyList.sort(sortByjdBeanNum);
for (let canBuyItem of $.canBuyList) {
if (canBuyItem.needWoB <= $.woB) {
await furnituresCenterPurchase(canBuyItem.id, canBuyItem.jdBeanNum);
break
}
}
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
//装饰领京豆
function furnituresCenterPurchase(id, jdBeanNum) {
return new Promise(resolve => {
$.post(taskPostUrl(`ssjj-furnitures-center/furnituresCenterPurchase/${id}`), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.head.code === 200) {
message += `【装饰领京豆】${jdBeanNum}兑换成功\n`;
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
//获取详情
function queryByUserId() {
return new Promise(resolve => {
$.get(taskUrl(`ssjj-wo-home-info/queryByUserId/2`), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.head.code === 200) {
if (data.body) {
message += `【小窝名】${data.body.name}\n`;
$.woB = data.body.woB;
message += `【当前WO币】${data.body.woB}\n`;
}
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
//获取需要关注的频道列表 //获取需要关注的频道列表
function queryChannelsList(taskId) { function queryChannelsList(taskId) {
return new Promise(resolve => { return new Promise(resolve => {
@@ -747,6 +810,25 @@ function taskUrl(url, body = {}) {
} }
} }
} }
function taskPostUrl(url) {
return {
url: `${JD_API_HOST}/${url}`,
headers: {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
"Connection": "keep-alive",
"content-type": "application/json",
"Host": "lkyl.dianpusoft.cn",
"Referer": "https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html",
"token": $.token,
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")
}
}
}
function sortByjdBeanNum(a, b) {
return b['jdBeanNum'] - a['jdBeanNum'];
}
function TotalBean() { function TotalBean() {
return new Promise(async resolve => { return new Promise(async resolve => {
const options = { const options = {

View File

@@ -40,12 +40,12 @@ inputs:
cronExpression: "0 3 */1 * * * *" cronExpression: "0 3 */1 * * * *"
enable: true enable: true
argument: jd_joy_feedPets&jd_joy&jd_moneyTree&jd_plantBean&jd_dreamFactory&jd_jdfactory argument: jd_joy_feedPets&jd_joy&jd_moneyTree&jd_plantBean&jd_dreamFactory&jd_jdfactory
- timer: # 宠汪汪积分兑换奖品# 宠汪汪偷好友积分与狗# 点点券 - timer: # 宠汪汪积分兑换奖品# 宠汪汪偷好友积分与狗# 点点券# 京东直播18豆
parameters: parameters:
name: jd_joy_reward_jd_joy_steal_jd_necklace name: joy_reward_joy_steal_necklace_live
cronExpression: "0 0 0-16/8,20 * * * *" cronExpression: "0 0 0-16/8,20 * * * *"
enable: true enable: true
argument: jd_joy_reward&jd_joy_steal&jd_necklace argument: jd_joy_reward&jd_joy_steal&jd_necklace&jd_live
- timer: # 京东全民开红包 # 进店领豆 # 取关京东店铺商品# 京东抽奖机# 东东小窝# 秒杀红包雨# 健康抽奖机 - timer: # 京东全民开红包 # 进店领豆 # 取关京东店铺商品# 京东抽奖机# 东东小窝# 秒杀红包雨# 健康抽奖机
parameters: parameters:
name: redPacket_shop_unsubscribe_lotteryMachine_small_home_ms_redrain_health name: redPacket_shop_unsubscribe_lotteryMachine_small_home_ms_redrain_health