JS script sharing of the latest JD 618 stack cake in 2020, complete all tasks with one click

I have been playing Stacking Cake on 618 JD.com for two days, and it’s the same on Taobao . Anyway, 7788 wants you to browse various pages, and wants you to open various memberships emmm~ Stacking Cake is divided into 1 billion activities. In order to save time and labor costs, Just go to the script.

JS script sharing of the latest JD 618 stack cake in 2020, complete all tasks with one click

 

Steps

It is recommended to use the latest version of Chrome. The User-Agent of the browser must include jdapp. If it is a Chrome browser, you can press F12 to modify it in Network Conditions in the developer tools.

Provide a UA

1

jdapp;android;8.3.0;9;865883042627193–60ab67f195fe;network/4g;model/MI 9 Transparent Edition;appBuild/69903;Mozilla/5.0(Linux; Android 9.0; MI 9 Transparent Edition Build/PKQ1.181121.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044330 Mobile Safari/537.36

Open Network Conditions

JS script sharing of the latest JD 618 stack cake in 2020, complete all tasks with one click

Modify UA

JS script sharing of the latest JD 618 stack cake in 2020, complete all tasks with one click

Then click the Sources tab, and click the Snippets tab on the left below (if not, please click the two right arrows) and then click New snippet to create a script, and then put all the contents in main.js (at the bottom of the article) Just paste it in

JS script sharing of the latest JD 618 stack cake in 2020, complete all tasks with one click

Visit  the JD mobile webpage, click [My] on the bottom navigation bar, and log in to the JD account. After the login is complete, right-click the script to run. The Console will notify you if the tasks are all complete, so please be patient.

JS script sharing of the latest JD 618 stack cake in 2020, complete all tasks with one click

After the task is completed, you can go to the Jingdong  APP to witness the miraculous moment.

JS script sharing of the latest JD 618 stack cake in 2020, complete all tasks with one click

Script code sharing

var secretp = "";
var taskList = [];

// 恢复被覆盖的 alert 函数
(() => {
var frame = document.createElement("iframe");
frame.style.display = "none";
document.body.appendChild(frame);
window.alert = frame.contentWindow.alert;
})();

// 请求函数
var request = (functionId, body = {}) =>
fetch("https://api.m.jd.com/client.action", {
body: `functionId=${functionId}&body=${JSON.stringify(
body
)}&client=wh5&clientVersion=1.0.0`,
headers: {
"content-type": "application/x-www-form-urlencoded",
},
method: "POST",
credentials: "include",
});

// 模拟任务完成请求
var collector = (task, actionType) => {
console.log(actionType ? "@领取任务:" : "@执行任务:", task);

request("cakebaker_ckCollectScore", {
taskId: task.taskId,
itemId: task.itemId,
actionType: actionType ? 1 : undefined,
safeStr: JSON.stringify({ secretp }),
})
.then((res) => res.json())
.then((res) => {
console.log("调用结果:", res.data);

// 如果是执行任务,即任务已经完成,则进行下一个任务
if (!actionType) {
start();
}
});
};

// 甄选优品任务处理
var superiorTask = (() => {
// 是否有请求正在执行
var isBusy = false;

return (rawTaskCollection) => {
var getFeedDetail = (copiedTaskCollection) => {
request("cakebaker_getFeedDetail", {
taskIds: copiedTaskCollection["productInfoVos"]
.map((item) => item.itemId)
.toString(),
})
.then((res) => res.json())
.then((res) => {
var result = res.data.result;

// 确认任务集合所在键名
var taskCollectionContentKeyName = Object.keys(result).find(
(keyName) => /Vos?$/.test(keyName) && !["taskVos"].includes(keyName)
);

result[taskCollectionContentKeyName].forEach((taskCollection) => {
Array(taskCollection.maxTimes - taskCollection.times)
.fill(true)
.forEach((_, index) => {
taskList.unshift({
taskName: taskCollection.taskName,
taskId: taskCollection.taskId,
taskType: taskCollection.taskType,
waitDuration: taskCollection.waitDuration,
itemId: taskCollection.productInfoVos[index].itemId,
});
});
});

// 解除请求锁定
isBusy = false;
});
};

if (!isBusy) {
isBusy = true;
getFeedDetail(JSON.parse(JSON.stringify(rawTaskCollection)));
} else {
// 一秒后重试
setTimeout(
getFeedDetail,
1000,
JSON.parse(JSON.stringify(rawTaskCollection))
);
}
};
})();

// 开始任务
var start = () => {
var task = taskList.pop();

if (task) {
// 除了小精灵和连签外的任务要先领取
if (!["小精灵", "连签得金币"].includes(task.taskName)) {
setTimeout(collector, 0, task, true);
}
// 至少等 2 秒再执行任务
setTimeout(collector, (2 + task.waitDuration) * 1000, task);
} else {
console.log("@任务已完成!");
alert("任务完成!");
}
};

(() => {
// 获取基础信息
Promise.all([
request("cakebaker_getHomeData"),
// 请求稍微慢点,避免提示【点太快啦!等下再来吧】
new Promise((resolve) => {
setTimeout(() => {
request("cakebaker_getTaskDetail").then(resolve);
}, 1000);
}),
])
.then(([homeData, taskData]) =>
Promise.all([homeData.json(), taskData.json()])
)
.then(([homeData, taskData]) => {
// 如果无法获取任务详情
if (taskData.data.bizCode !== 0) {
if (
taskData.data.bizCode === -7 &&
!~navigator.userAgent.indexOf("jdapp")
) {
console.log("当前浏览器 UA:" + navigator.userAgent);
throw "任务详情获取失败,请确保已设置正确的浏览器 User-Agent。";
} else {
throw `【错误信息:${JSON.stringify(taskData.data)}】`;
}
}

// 获取签名 token
secretp = homeData.data.result.cakeBakerInfo.secretp;

// 生成任务队列
taskData.data.result.taskVos.forEach(async (taskCollection) => {
// 跳过部分邀请任务
if (
["邀请好友助力", "所在战队成员满5人"].includes(
taskCollection.taskName
)
)
return;

// 针对甄选优品任务的处理
if (taskCollection["productInfoVos"]) {
superiorTask(taskCollection);
}

// 确认任务集合所在键名
var taskCollectionContentKeyName = Object.keys(taskCollection).find(
(keyName) =>
/Vos?$/.test(keyName) &&
!["productInfoVos", "scoreRuleVos"].includes(keyName)
);

// 某类任务下的任务集合内容
taskCollectionContent = taskCollection[taskCollectionContentKeyName];

if (!taskCollectionContent) return;

Array(taskCollection.maxTimes - taskCollection.times)
.fill(true)
.forEach((_, index) => {
taskList.push({
taskName: taskCollection.taskName,
taskId: taskCollection.taskId,
taskType: taskCollection.taskType,
waitDuration: taskCollection.waitDuration,
itemId:
taskCollectionContent instanceof Array
? taskCollectionContent[index].itemId
: taskCollectionContent.itemId,
});
});
});

console.log(taskList);

// 开始任务
start();
});
})();

 

Precautions

Some bloggers reminded that the task may be different after each call. It is recommended to run the script once or twice more, and generally three times can run all the tasks.

Guess you like

Origin blog.csdn.net/weixin_39691535/article/details/106594687