新增新版本的摇一摇功能,包括领取一次免费的机会
This commit is contained in:
@@ -78,6 +78,8 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
|||||||
async function clubLottery() {
|
async function clubLottery() {
|
||||||
await doTasks();//做任务
|
await doTasks();//做任务
|
||||||
await getFreeTimes();//获取摇奖次数
|
await getFreeTimes();//获取摇奖次数
|
||||||
|
await vvipclub_receive_lottery_times();//新版:领取一次免费的机会
|
||||||
|
await vvipclub_shaking_info();//新版:查询多少次摇奖次数
|
||||||
await shaking();//开始摇奖
|
await shaking();//开始摇奖
|
||||||
}
|
}
|
||||||
async function doTasks() {
|
async function doTasks() {
|
||||||
@@ -133,6 +135,19 @@ async function shaking() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (let i = 0; i < new Array($.leftShakingTimes).fill('').length; i++) {
|
||||||
|
console.log(`开始新版-摇奖`)
|
||||||
|
await $.wait(2000);
|
||||||
|
const newShakeBeanRes = await vvipclub_shaking_lottery();
|
||||||
|
if (newShakeBeanRes.success) {
|
||||||
|
console.log(`新版-剩余摇奖次数:${newShakeBeanRes.data.remainLotteryTimes}`)
|
||||||
|
if (newShakeBeanRes.data && newShakeBeanRes.data.rewardBeanAmount) {
|
||||||
|
$.prizeBeanCount += newShakeBeanRes.data.rewardBeanAmount;
|
||||||
|
} else {
|
||||||
|
console.log(`未中奖`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function showMsg() {
|
function showMsg() {
|
||||||
if ($.prizeBeanCount) {
|
if ($.prizeBeanCount) {
|
||||||
@@ -140,6 +155,105 @@ function showMsg() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//====================API接口=================
|
//====================API接口=================
|
||||||
|
//查询剩余摇奖次数API
|
||||||
|
function vvipclub_shaking_info() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const options = {
|
||||||
|
url: `https://api.m.jd.com/?t=${Date.now()}&appid=sharkBean&functionId=vvipclub_shaking_info`,
|
||||||
|
headers: {
|
||||||
|
"accept": "application/json",
|
||||||
|
"accept-encoding": "gzip, deflate, br",
|
||||||
|
"accept-language": "zh-CN,zh;q=0.9",
|
||||||
|
"cookie": cookie,
|
||||||
|
"origin": "https://skuivip.jd.com",
|
||||||
|
"referer": "https://skuivip.jd.com/",
|
||||||
|
"user-agent": "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.get(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
|
||||||
|
$.logErr(err);
|
||||||
|
} else {
|
||||||
|
// console.log(data)
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.success) {
|
||||||
|
$.leftShakingTimes = data.data.leftShakingTimes;//剩余抽奖次数
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp);
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//新版摇奖API
|
||||||
|
function vvipclub_shaking_lottery() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const options = {
|
||||||
|
url: `https://api.m.jd.com/?t=${Date.now()}&appid=sharkBean&functionId=vvipclub_shaking_lottery&body=%7B%7D`,
|
||||||
|
headers: {
|
||||||
|
"accept": "application/json",
|
||||||
|
"accept-encoding": "gzip, deflate, br",
|
||||||
|
"accept-language": "zh-CN,zh;q=0.9",
|
||||||
|
"cookie": cookie,
|
||||||
|
"origin": "https://skuivip.jd.com",
|
||||||
|
"referer": "https://skuivip.jd.com/",
|
||||||
|
"user-agent": "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.get(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
|
||||||
|
$.logErr(err);
|
||||||
|
} else {
|
||||||
|
// console.log(data)
|
||||||
|
data = JSON.parse(data);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp);
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//领取新版本摇一摇一次免费的次数
|
||||||
|
function vvipclub_receive_lottery_times() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const options = {
|
||||||
|
url: `https://api.m.jd.com/?t=${Date.now()}&appid=sharkBean&functionId=vvipclub_receive_lottery_times`,
|
||||||
|
headers: {
|
||||||
|
"accept": "application/json",
|
||||||
|
"accept-encoding": "gzip, deflate, br",
|
||||||
|
"accept-language": "zh-CN,zh;q=0.9",
|
||||||
|
"cookie": cookie,
|
||||||
|
"origin": "https://skuivip.jd.com",
|
||||||
|
"referer": "https://skuivip.jd.com/",
|
||||||
|
"user-agent": "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.get(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
|
||||||
|
$.logErr(err);
|
||||||
|
} else {
|
||||||
|
// console.log(data)
|
||||||
|
data = JSON.parse(data);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp);
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
//查询多少次机会
|
//查询多少次机会
|
||||||
function getFreeTimes() {
|
function getFreeTimes() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
@@ -261,9 +375,9 @@ function TotalBean() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function taskUrl(function_id, body = {}) {
|
function taskUrl(function_id, body = {}, appId = 'vip_h5') {
|
||||||
return {
|
return {
|
||||||
url: `${JD_API_HOST}?functionId=${function_id}&appid=vip_h5&body=${escape(JSON.stringify(body))}&_=${Date.now()}`,
|
url: `${JD_API_HOST}?functionId=${function_id}&appid=${appId}&body=${escape(JSON.stringify(body))}&_=${Date.now()}`,
|
||||||
headers: {
|
headers: {
|
||||||
'Cookie': cookie,
|
'Cookie': cookie,
|
||||||
'Host': 'api.m.jd.com',
|
'Host': 'api.m.jd.com',
|
||||||
|
Reference in New Issue
Block a user