增加内部账号互助
This commit is contained in:
162
jd_xtg.js
162
jd_xtg.js
@@ -2,7 +2,7 @@
|
|||||||
* @Author: LXK9301
|
* @Author: LXK9301
|
||||||
* @Date: 2020-10-21 17:04:04
|
* @Date: 2020-10-21 17:04:04
|
||||||
* @Last Modified by: LXK9301
|
* @Last Modified by: LXK9301
|
||||||
* @Last Modified time: 2021-05-27 13:15:04
|
* @Last Modified time: 2021-05-27 18:15:04
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
家电星推官脚本
|
家电星推官脚本
|
||||||
@@ -54,14 +54,6 @@ let starID = [
|
|||||||
"starId": "ykd-liutao",
|
"starId": "ykd-liutao",
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const shareID = [
|
|
||||||
"39440572-136a-4b38-bc13-f767d07406fb",
|
|
||||||
"796a8a5e-ef50-4501-a6a6-b7717de022ae",
|
|
||||||
"2bc87513-9344-453c-8733-a106bcbbb6a7",
|
|
||||||
"f18b535a-d9c0-48c7-9a15-16f674065b64",
|
|
||||||
"a778e308-858d-4039-a4f0-15aafbb83181",
|
|
||||||
"45f97217-e150-4dc9-baed-054a4e07ae02",
|
|
||||||
];
|
|
||||||
$.allShareId = {};
|
$.allShareId = {};
|
||||||
const JD_API_HOST = "https://guardianstarjd.m.jd.com/star";
|
const JD_API_HOST = "https://guardianstarjd.m.jd.com/star";
|
||||||
!(async () => {
|
!(async () => {
|
||||||
@@ -121,41 +113,51 @@ const JD_API_HOST = "https://guardianstarjd.m.jd.com/star";
|
|||||||
$.times = 0;
|
$.times = 0;
|
||||||
await JD_XTG(true);
|
await JD_XTG(true);
|
||||||
}
|
}
|
||||||
// console.log(`\n等待8秒后,再去领取奖励\n`);
|
|
||||||
// console.log(`做任务之前京豆总计:${$.beanCount}`)
|
|
||||||
// await $.wait(8000);
|
|
||||||
// for (let index = 0; index < starID.length; index++) {
|
|
||||||
// $.activeId = starID[index]['starId'];
|
|
||||||
// $.j = index;
|
|
||||||
// await JD_XTG();
|
|
||||||
// // await doSupport(shareID[index]);
|
|
||||||
// }
|
|
||||||
// $.allShareId[i] = $.shareID;
|
|
||||||
// const afterTotal = await TotalBean();
|
|
||||||
// $.jdNum = afterTotal['base'].jdNum;
|
|
||||||
await showMsg();
|
await showMsg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($.isNode() && allMsg) {
|
if ($.isNode() && allMsg) {
|
||||||
await notify.sendNotify($.name, allMsg);
|
await notify.sendNotify($.name, allMsg);
|
||||||
}
|
}
|
||||||
// console.log($.allShareId);
|
//助力功能
|
||||||
// for (let v = 0; v < cookiesArr.length; v++) {
|
for (let index = 0; index < starID.length; index++) {
|
||||||
// cookie = cookiesArr[v];
|
$.invites = [];
|
||||||
// console.log(`自己账号内部互助\n\n`);
|
$.activeId = starID[index]['starId'];
|
||||||
// for (let item of Object.keys($.allShareId)) {
|
$.appIndex = index + 1;
|
||||||
// for (let index = 0; index < starID.length; index++) {
|
console.log(`\n获取星推官【${$.activeId}】下的邀请码\n`)
|
||||||
// $.activeId = starID[index]['starId'];
|
for (let v = 0; v < cookiesArr.length; v++) {
|
||||||
// console.log(`账号${v + 1}去助力 账号${Number(item) + 1} 的${$.activeId}活动的邀请码${$.allShareId[item][index]}\n`)
|
cookie = cookiesArr[v];
|
||||||
// await doSupport($.allShareId[item][index]);
|
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
||||||
// }
|
$.index = v + 1;
|
||||||
// }
|
await initSuportInfo();
|
||||||
// console.log(`如有剩下的机会,助力作者\n\n`);
|
}
|
||||||
// for (let index = 0; index < starID.length; index++) {
|
if ($.invites.length > 0) {
|
||||||
// $.activeId = starID[index]['starId'];
|
$.allShareId[starID[index]['starId']] = $.invites;
|
||||||
// await doSupport(shareID[index]['starId']);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
if (!cookiesArr || cookiesArr.length < 2) return
|
||||||
|
for (let v = 0; v < cookiesArr.length; v++) {
|
||||||
|
cookie = cookiesArr[v];
|
||||||
|
$.index = v + 1;
|
||||||
|
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
||||||
|
console.log(`自己账号内部互助\n\n`);
|
||||||
|
for (let oneAppId in $.allShareId) {
|
||||||
|
let oneAcHelpList = $.allShareId[oneAppId];
|
||||||
|
for (let j = 0; j < oneAcHelpList.length; j++) {
|
||||||
|
$.item = oneAcHelpList[j];
|
||||||
|
if ($.UserName === $.item['userName']) continue;
|
||||||
|
if (!$.item['inviteId'] || $.item['max']) continue
|
||||||
|
console.log(`账号${$.index} ${$.UserName} 去助力账号 ${$.item['userName']}的第${$.item['index']}个星推官活动【${$.item['starId']}】,邀请码 【${$.item['inviteId']}】`)
|
||||||
|
$.canHelp = true;
|
||||||
|
$.activeId = $.item['starId'];
|
||||||
|
await doSupport($.item['inviteId']);
|
||||||
|
if (!$.canHelp) {
|
||||||
|
console.log(`助力机会已耗尽,跳出`);
|
||||||
|
break;//此处如果break,则遇到第一个活动就无助力机会时,不会继续助力第二个活动了
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})()
|
})()
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
$.log("", `❌ ${$.name}, 失败! 原因: ${e}!`, "");
|
$.log("", `❌ ${$.name}, 失败! 原因: ${e}!`, "");
|
||||||
@@ -248,7 +250,14 @@ function initSuportInfo() {
|
|||||||
// console.log(`\n助力结果:${data}`);
|
// console.log(`\n助力结果:${data}`);
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
if (data['code'] === 200) {
|
if (data['code'] === 200) {
|
||||||
$.shareID.push(data.data);//邀请码
|
console.log(`账号${$.index} ${$.UserName} ${$.activeId}星推官邀请码:${data.data}`);
|
||||||
|
$.invites.push({
|
||||||
|
inviteId: data.data,
|
||||||
|
userName: $.UserName,
|
||||||
|
starId: $.activeId,
|
||||||
|
index: $.appIndex,
|
||||||
|
max: false
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log(`邀请码获取失败:`)
|
console.log(`邀请码获取失败:`)
|
||||||
}
|
}
|
||||||
@@ -358,79 +367,24 @@ function getBrowsePrize(browseId) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function shareTask(shareId) {
|
|
||||||
let r = Date.now().toString();
|
|
||||||
let hi = "07035cabb557f096";
|
|
||||||
let o = hi + r;
|
|
||||||
let t = "/guardianstar/shareTask";
|
|
||||||
let a = `starId=${$.activeId}&shareId=${shareId}`;
|
|
||||||
return new Promise(async (resolve) => {
|
|
||||||
const options = {
|
|
||||||
url: `${JD_API_HOST}/shareTask`,
|
|
||||||
body: `shareId=${shareId}&starId=${$.activeId}`,
|
|
||||||
headers: {
|
|
||||||
Accept: "application/json,text/plain, */*",
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br",
|
|
||||||
"Accept-Language": "zh-cn",
|
|
||||||
Connection: "keep-alive",
|
|
||||||
Cookie: cookie,
|
|
||||||
Host: "guardianstarjd.m.jd.com",
|
|
||||||
Referer: "https://guardianstarjd.m.jd.com/",
|
|
||||||
sign: za(a, o, t).toString(),
|
|
||||||
timestamp: r,
|
|
||||||
"User-Agent": "jdapp;android;9.4.4;10;3b78ecc3f490c7ba;network/UNKNOWN;model/M2006J10C;addressid/138543439;aid/3b78ecc3f490c7ba;oaid/7d5870c5a1696881;osVer/29;appBuild/85576;psn/3b78ecc3f490c7ba|541;psq/2;uid/3b78ecc3f490c7ba;adk/;ads/;pap/JA2015_311210|9.2.4|ANDROID 10;osv/10;pv/548.2;jdv/0|iosapp|t_335139774|appshare|CopyURL|1606277982178|1606277986;ref/com.jd.lib.personal.view.fragment.JDPersonalFragment;partner/xiaomi001;apprpd/MyJD_Main;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
$.post(options, (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
console.log(`${JSON.stringify(err)}`);
|
|
||||||
console.log(`${$.name} API请求失败,请检查网路重试`);
|
|
||||||
} else {
|
|
||||||
// console.log(`好友助力领京豆结果:${data}`);
|
|
||||||
// data = JSON.parse(data);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function doSupport(shareId) {
|
function doSupport(shareId) {
|
||||||
let r = Date.now().toString();
|
|
||||||
let hi = "07035cabb557f096";
|
|
||||||
let o = hi + r;
|
|
||||||
let t = "doSupport";
|
|
||||||
let a = `starId=${$.activeId}&shareId=${shareId}`;
|
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
const options = {
|
const options = taskPostUrl('task/doSupport', 'doSupport', `starId=${$.activeId}&shareId=${shareId}`)
|
||||||
url: `${JD_API_HOST}/doSupport`,
|
|
||||||
body: `starId=${$.activeId}&shareId=${shareId}`,
|
|
||||||
headers: {
|
|
||||||
Accept: "application/json,text/plain, */*",
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br",
|
|
||||||
"Accept-Language": "zh-cn",
|
|
||||||
Connection: "keep-alive",
|
|
||||||
Cookie: cookie,
|
|
||||||
Host: "guardianstarjd.m.jd.com",
|
|
||||||
Referer: "https://guardianstarjd.m.jd.com/",
|
|
||||||
sign: za(a, o, t).toString(),
|
|
||||||
timestamp: r,
|
|
||||||
"User-Agent": "jdapp;android;9.4.4;10;3b78ecc3f490c7ba;network/UNKNOWN;model/M2006J10C;addressid/138543439;aid/3b78ecc3f490c7ba;oaid/7d5870c5a1696881;osVer/29;appBuild/85576;psn/3b78ecc3f490c7ba|541;psq/2;uid/3b78ecc3f490c7ba;adk/;ads/;pap/JA2015_311210|9.2.4|ANDROID 10;osv/10;pv/548.2;jdv/0|iosapp|t_335139774|appshare|CopyURL|1606277982178|1606277986;ref/com.jd.lib.personal.view.fragment.JDPersonalFragment;partner/xiaomi001;apprpd/MyJD_Main;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(`${JSON.stringify(err)}`);
|
console.log(`${JSON.stringify(err)}`);
|
||||||
console.log(`${$.name} API请求失败,请检查网路重试`);
|
console.log(`${$.name} API请求失败,请检查网路重试`);
|
||||||
} else {
|
} else {
|
||||||
// console.log(`\n助力结果:${data}`);
|
data = JSON.parse(data);
|
||||||
// data = JSON.parse(data);
|
if (data && data.code === 200) {
|
||||||
|
if (data['data']['status'] === 6) {
|
||||||
|
console.log('助力成功')
|
||||||
|
}
|
||||||
|
if (data['data']['status'] === 5) $.canHelp = false;
|
||||||
|
if (data['data']['status'] === 4) $.item['max'] = true;
|
||||||
|
}
|
||||||
|
console.log(`助力结果:${JSON.stringify(data)}\n`);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$.logErr(e, resp);
|
$.logErr(e, resp);
|
||||||
|
|||||||
Reference in New Issue
Block a user