更新于 08-17 12:04

This commit is contained in:
root
2021-08-17 12:04:49 -04:00
parent 1906f6b483
commit e51c557879
19 changed files with 3363 additions and 3603 deletions

View File

@@ -183,5 +183,8 @@
#大乐透 #大乐透
15 6 * * * node /scripts/jd_DrawEntrance.js >> /scripts/logs/jd_DrawEntrance.log 2>&1 15 6 * * * node /scripts/jd_DrawEntrance.js >> /scripts/logs/jd_DrawEntrance.log 2>&1
0 8,12 * * * node /scripts/jd_crowdfunding_wish.js >> /scripts/logs/jd_crowdfunding_wish.log 2>&1
8 8 * * * node /scripts/jd_shop_sign.js >> /scripts/logs/jd_shop_sign.log 2>&1
##############可选脚本############## ##############可选脚本##############

613
jd_5g.js

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

106
jd_cash_exchange.js Executable file
View File

@@ -0,0 +1,106 @@
/*
签到领现金兑换
需要填写exchangeAccounts参数兑换多少取决于app内显示默认为所有账号兑换10红包部分账号会出现参数错误的提示。指定账号+金额应这样填写 export exchangeAccounts="pt_pin1@2&pt_pin2@10"
0 0 * * * jd_cash_exchange.js
*/
const jd_helpers = require("./utils/JDHelpers.js");
const jd_env = require("./utils/JDEnv.js");
const $ = jd_env.env("签到领现金兑换");
const ua = `jdltapp;iPhone;3.1.0;${Math.ceil(Math.random() * 4 + 10)}.${Math.ceil(Math.random() * 4)};${randomString(40)}`;
let cookiesArr = [];
var exchangeAccounts = process.env.exchangeAccounts ?? "";
let amount = 10;
!(async () => {
if (exchangeAccounts) {
v = exchangeAccounts.split("&");
exchangeAccounts = {};
for (var i of v) {
j = i.split("@");
exchangeAccounts[j[0]] = j[1] ? +j[1] : 10;
}
}
await requireConfig();
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
pt_pin = cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1];
amount = 0;
if (exchangeAccounts) {
amount = exchangeAccounts[pt_pin];
if (!amount) continue;
}
exchange(cookie, amount, pt_pin);
}
}
await $.wait(3000);
})();
function exchange(cookie, amount, pt_pin) {
body = "";
if (amount == 2) {
body = `adid=41CBA646-6EA3-4E79-8623-680F74A5FD7D&body={"type":"2","amount":"200"}&build=167724&client=apple&clientVersion=10.0.6&d_brand=apple&d_model=iPhone10,4&eid=eidI56d7812024s3J0UGWUp+RVK4+9/EY14sMidFB85YSXDSHPI9r07frvvGbXtVFQYuMENUoWFIARXaAYlZNGDyc8dfGQqd42Fer11K0PRjAQjbTBp5&isBackground=N&joycious=79&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=96ca9290eae9f41770e2c16fd4d07c67eb06b445&osVersion=14.4.2&partner=apple&rfs=0000&scope=10&screen=750*1334&sign=1be417384d1ffccde3dbf6a207277706&st=1625756188161&sv=111&uemps=0-0&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJCNy5Ou1kywjunNJYhK2mQzTDwvkNHz8d6J9JA+AN8f7dHT8E/pp+/K+s+/hw3ktfXf7rIWQ3qVqjrVZ8RJpuJJq5WCCsy0wGM2uum+4ppHaNVwnSBrL/ZniFeKJAAxcyCaBFHBfNkP1t3YA8CtB8pQTjm5pvQ/eWyy8qqiBgfB+iPthLx1deRA==&uuid=hjudwgohxzVu96krv/T6Hg==`;
} else {
amount = 10;
body = `adid=A23D8ECF-B992-477E-BA88-A5E7680DD8F6&body={"type":"2","amount":"1000"}&build=167638&client=apple&clientVersion=9.5.0&eid=eidI5E4E0119RTBCMkMxNEMtNjgxQi00NQ==20v8iy1ivQ9DClEjHXmgvcd5v2MhcsarbJkOkdI5EZKIlK2CiFmfRE6MG017DU87QAHcuwoYwkjGXGws&isBackground=N&joycious=61&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=3245ad3d16ab2153c69f9ca91cd2e931b06a3bb8&osVersion=13.6.1&rfs=0000&scope=11&screen=1242*2208&sign=427a28328d1650d4c553c1cfdf25744c&st=1618885128891&sv=100&uemps=0-0&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJ/+MrMjk4y13kWuMN4VaxQad1iD1QgEcDK/YYLWTuOPAd1akjd5yd8GStO+tvG+FdogNDbDiKjvQgXieBZsBtY63e8GaM2SFD74E/SCZQOKBCgUHo9/gWatL87O9NO0DFzwx44pkT4mA7/S1gDn01AyEbB70wvtsnPtixLxroKuYYDIBNepnJLQ==&uuid=hjudwgohxzVu96krv/T6Hg==`;
}
$.post(
{
url: "https://api.m.jd.com/client.action?functionId=cash_getRedPacket",
headers: {
Cookie: cookie,
Accept: "*/*",
Connection: "keep-alive",
"Accept-Encoding": "gzip, deflate, br",
"User-Agent": ua,
"Accept-Language": "zh-Hans-CN;q=1",
Host: "api.m.jd.com",
"Content-Type": "application/x-www-form-urlencoded",
},
body: body,
},
(err, resp, data) => {
try {
data = JSON.parse(data);
if (data.data) {
if (data.data.bizMsg.indexOf("success") != -1) {
data.data.bizMsg = `成功兑换${amount}元红包`;
notify.sendNotify(`签到领现金账号 ${decodeURIComponent(pt_pin)}`, data.data.bizMsg);
}
}
if (data.errorMessage) {
console.log(data.errorMessage);
}
} catch (e) {
$.logErr("Error: ", e, resp);
}
}
);
}
function requireConfig() {
return new Promise((resolve) => {
notify = $.isNode() ? require("./sendNotify") : "";
const jdCookieNode = $.isNode() ? require("./jdCookie.js") : "";
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
if (jdCookieNode[item]) {
cookiesArr.push(jdCookieNode[item]);
}
});
if (process.env.JD_DEBUG && process.env.JD_DEBUG === "false") console.log = () => {};
} else {
cookiesArr = [$.getdata("CookieJD"), $.getdata("CookieJD2"), ...jd_helpers.jsonParse($.getdata("CookiesJD") || "[]").map((item) => item.cookie)].filter((item) => !!item);
}
console.log(`${cookiesArr.length}个京东账号\n`);
resolve();
});
}
function randomString(e) {
e = e || 32;
let t = "abcdefhijkmnprstwxyz2345678",
a = t.length,
n = "";
for (i = 0; i < e; i++) n += t.charAt(Math.floor(Math.random() * a));
return n;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

322
jd_crowdfunding_wish.js Executable file
View File

@@ -0,0 +1,322 @@
/*
cron "0 8,12 * * *" jd_crowdfunding_wish.js
*/
const jd_helpers = require("./utils/JDHelpers.js");
const jd_env = require("./utils/JDEnv.js");
const $ = jd_env.env("京东众筹许愿池");
const notify = $.isNode() ? require("./sendNotify") : "";
const jdCookieNode = $.isNode() ? require("./jdCookie.js") : "";
let timestamp = Date.now();
let cookiesArr = [],
cookie = "",
message;
a = "";
let allMessage = "";
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item]);
});
if (process.env.JD_DEBUG && process.env.JD_DEBUG === "false")
console.log = () => {};
} else {
cookiesArr = [$.getdata("CookieJD"), $.getdata("CookieJD2"), ...jd_helpers.jsonParse($.getdata("CookiesJD") || "[]").map((item) => item.cookie)].filter((item) => !!item);
}
const JD_API_HOST = "https://api.m.jd.com/client.action";
!(async () => {
if (!cookiesArr[0]) {
$.msg(
$.name,
"【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取",
"https://bean.m.jd.com/",
{
"open-url": "https://bean.m.jd.com/",
}
);
return;
}
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
ck2 = cookiesArr[Math.round(Math.random() * 5)];
$.UserName = decodeURIComponent(
cookie.match(/pt_pin=([^; ]+)(?=;?)/) &&
cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]
);
$.index = i + 1;
message = "";
console.log(`\n******开始【京东账号${$.index}${$.UserName}*********\n`);
await task();
}
}
if ($.isNode() && allMessage && !process.env.CROWDFUNDING_WISH_NOTIFY_CONTROL) {
await notify.sendNotify(`${$.name}`, `${allMessage}`);
}
})()
.catch((e) => {
$.log("", `${$.name}, 失败! 原因: ${e}!`, "");
})
.finally(() => {
$.done();
});
function showMsg() {
return new Promise((resolve) => {
$.log($.name, "", `京东账号${$.index}${$.nickName}\n${message}`);
resolve();
});
}
function task() {
return new Promise(async (resolve) => {
let options = {
url: `https://api.m.jd.com/client.action`,
body: `functionId=healthyDay_getHomeData&body={"appId":"1E1NXxq0","taskToken":"","channelId":1}&client=wh5&clientVersion=1.0.0`,
headers: {
Origin: "https://h5.jd.com",
Host: "api.m.jd.com",
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",
Cookie: cookie,
},
};
$.post(options, async (err, resp, data) => {
try {
data = JSON.parse(data);
if (data.data.bizMsg == "success") {
$.log(`===============存货金币===============`);
$.log(`${data.data.result.userInfo.userScore}`);
userScore = data.data.result.userInfo.userScore;
$.log(`===============抽奖需要===============`);
$.log(`${data.data.result.userInfo.scorePerLottery}`);
scorePerLottery = data.data.result.userInfo.scorePerLottery;
tasklist = data.data.result.taskVos;
$.log(`===============去做任务===============`);
$.log(`===============浏览并关注众筹频道===============`);
tk = tasklist[0].shoppingActivityVos[0].taskToken;
taskId = tasklist[0].taskId;
await dotask(tk, taskId, 0);
await dotask(tk, taskId, 1);
await dotask(tk, taskId, 0);
$.log(`===============浏览众筹频道===============`);
tk = tasklist[1].shoppingActivityVos[0].taskToken;
taskId = tasklist[1].taskId;
await dotask(tk, taskId, 0);
await dotask(tk, taskId, 1);
await $.wait(15000);
await dotask(tk, taskId, 0);
$.log(`===============每浏览商品10s可获得200金币===============`);
tk = tasklist[2].productInfoVos[0].taskToken;
taskId = tasklist[2].taskId;
item = tasklist[2].productInfoVos[0].itemId;
await dotask(tk, taskId, 0, item);
await dotask(tk, taskId, 1, item);
await $.wait(11000);
await dotask(tk, taskId, 0, item);
tk = tasklist[2].productInfoVos[1].taskToken;
taskId = tasklist[2].taskId;
item = tasklist[2].productInfoVos[1].itemId;
await dotask(tk, taskId, 0, item);
await dotask(tk, taskId, 1, item);
await $.wait(11000);
await dotask(tk, taskId, 0, item);
tk = tasklist[2].productInfoVos[2].taskToken;
taskId = tasklist[2].taskId;
item = tasklist[2].productInfoVos[2].itemId;
await dotask(tk, taskId, 0, item);
await dotask(tk, taskId, 1, item);
await $.wait(11000);
await dotask(tk, taskId, 0, item);
tk = tasklist[2].productInfoVos[3].taskToken;
item = tasklist[2].productInfoVos[3].itemId;
taskId = tasklist[2].taskId;
await dotask(tk, taskId, 0, item);
await dotask(tk, taskId, 1, item);
await $.wait(11000);
await dotask(tk, taskId, 0, item);
tk = tasklist[2].productInfoVos[4].taskToken;
item = tasklist[2].productInfoVos[4].itemId;
taskId = tasklist[2].taskId;
await dotask(tk, taskId, 0, item);
await dotask(tk, taskId, 1, item);
await $.wait(11000);
await dotask(tk, taskId, 0, item);
$.log(`===============邀请一个好友助力可获得300金币===============`);
tk = tasklist[3].assistTaskDetailVo.taskToken;
taskId = tasklist[3].taskId;
yqm = tasklist[3].assistTaskDetailVo.itemId;
$.log(`邀请码${yqm}\n正在取随机CK互相助力3次`);
for (let i = 0; i < 3; i++) {
await help(tk, taskId, 0, yqm);
await help(tk, taskId, 1, yqm);
await help(tk, taskId, 0, yqm);
}
$.log(`===============关注店铺可获得200金币===============`);
tk = tasklist[4].followShopVo[0].taskToken;
item = tasklist[4].followShopVo[0].itemId;
taskId = tasklist[4].taskId;
await dotask(tk, taskId, 0, item);
await dotask(tk, taskId, 1, item);
await dotask(tk, taskId, 0, item);
tk = tasklist[4].followShopVo[1].taskToken;
item = tasklist[4].followShopVo[1].itemId;
taskId = tasklist[4].taskId;
await dotask(tk, taskId, 0, item);
await dotask(tk, taskId, 1, item);
await dotask(tk, taskId, 0, item);
tk = tasklist[4].followShopVo[2].taskToken;
item = tasklist[4].followShopVo[2].itemId;
taskId = tasklist[4].taskId;
await dotask(tk, taskId, 0, item);
await dotask(tk, taskId, 1, item);
await dotask(tk, taskId, 0, item);
$.log(`===============连续签到===============`);
tk = tasklist[5].simpleRecordInfoVo.taskToken;
item = tasklist[5].simpleRecordInfoVo.itemId;
taskId = tasklist[5].taskId;
await dotask(tk, taskId, 0, item);
await dotask(tk, taskId, 1, item);
await dotask(tk, taskId, 0, item);
await getLottery();
cj = $.userScore / 500;
cj = parseInt(cj);
if (cj > 0) {
for (let i = 0; i < cj; i++) {
await getLottery();
}
}
} else if (data.data.bizMsg !== "success") {
console.log(data.msg);
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
function help(taskToken, taskId, actionType, itemId) {
return new Promise(async (resolve) => {
let options = {
url: `https://api.m.jd.com/client.action`,
body: `functionId=harmony_collectScore&body={"appId":"1E1NXxq0","taskToken":"${taskToken}","taskId":${taskId},"itemId":"${itemId}","actionType":${actionType}}&client=wh5&clientVersion=1.0.0`,
headers: {
Origin: "https://h5.jd.com",
Host: "api.m.jd.com",
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",
Cookie: ck2,
},
};
$.post(options, async (err, resp, data) => {
try {
data = JSON.parse(data);
const bizMsg = data?.data?.bizMsg;
if (bizMsg == "success") {
$.log(`===============任务完成===============`);
console.log(bizMsg);
$.log(`获得${data.data.result.userScore}`);
} else if (bizMsg !== "success") {
console.log(bizMsg);
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
function dotask(taskToken, taskId, actionType, itemId) {
return new Promise(async (resolve) => {
let options = {
url: `https://api.m.jd.com/client.action`,
body: `functionId=harmony_collectScore&body={"appId":"1E1NXxq0","taskToken":"${taskToken}","taskId":${taskId},"itemId":"${itemId}","actionType":${actionType}}&client=wh5&clientVersion=1.0.0`,
headers: {
Origin: "https://h5.jd.com",
Host: "api.m.jd.com",
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",
Cookie: cookie,
},
};
$.post(options, async (err, resp, data) => {
try {
data = JSON.parse(data);
if (data.data.bizMsg == "success") {
$.log(`===============任务完成===============`);
console.log(data.data.bizMsg);
$.log(`获得${data.data.result.userScore}`);
} else if (data.data.bizMsg !== "success") {
console.log(data.data.bizMsg);
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
function getLottery() {
return new Promise(async (resolve) => {
let options = {
url: `https://api.m.jd.com/client.action`,
body: `functionId=interact_template_getLotteryResult&body={"appId":"1E1NXxq0"}&client=wh5&clientVersion=1.0.0`,
headers: {
Origin: "https://h5.jd.com",
Host: "api.m.jd.com",
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",
Cookie: cookie,
},
};
$.post(options, async (err, resp, data) => {
try {
data = JSON.parse(data);
if (data.data.bizMsg == "success") {
$.userScore = data.data.result.userScore;
$.bizMsg = data.data.bizMsg;
$.log(`===============开始抽奖===============`);
if (data.data.result.userAwardsCacheDto.jBeanAwardVo) {
$.log(data.data.result.userAwardsCacheDto.jBeanAwardVo.prizeName);
allMessage += `京东账号${$.index}-${
$.nickName || $.UserName
}\n抽奖京豆: ${
data.data.result.userAwardsCacheDto.jBeanAwardVo.quantity
}${$.index !== cookiesArr.length ? "\n\n" : "\n\n"}`;
} else $.log(`啥都没抽到`);
} else if (data.data.bizMsg !== "success") {
console.log(data.data.bizMsg);
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

339
jd_shop_sign.js Executable file
View File

@@ -0,0 +1,339 @@
/*
店铺签到各类店铺签到有新的店铺直接添加token即可
*/
const jd_helpers = require('./utils/JDHelpers.js');
const jd_env = require('./utils/JDEnv.js');
const $ = jd_env.env('店铺签到');
const notify = $.isNode() ? require('./sendNotify') : '';
//Node.js用户请在jdCookie.js处填写京东ck;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [],
cookie = '',
message;
const JD_API_HOST = 'https://api.m.jd.com/api?appid=interCenter_shopSign';
let activityId = '';
let vender = '';
let num = 0;
let shopname = '';
const token = [
'020E4A5B75AE493CDF3020628CA72FDE', // 3天10豆5天20豆7天35豆
'ACD7EB42FB65AF1A447AEB329235DE04', // 每日3豆15天100豆
'5BB2C6C6332AD842011240152F7550EB', // 每日6豆7天100豆
'6C6B2702DDAAEDEBE5E68E41B6264CF6', // 每日5豆7天200积分
'CDC56C42F64CA34677E5894F28AF4871', // 每日100分1天200分、2豆2天1000分、25-3券
'2075567CC6ED0F30EAFFCF901F6C486D', // 每日2豆10天100豆
'CAF5BA5BF6B8317E282FCBF9F5C00B0E', // 每日2豆5天10豆10天20豆15天25豆
'A133DE5D8D1A5A612F49CBE1D9BCE7AA', // 每日2豆20天5元e卡
'E9E4861F0B12E5E483C949C818E3EAB8', // 每日1豆10天20豆20天50豆
'83E9B38C310EB5D26657977EF8FECA0F', // 7天20积分15天30豆
'7DE1E4B12326576BF7C5D347CC909451', // 每日10豆7天100豆
'513B43DB672C8C7B0D975DB75328A131', // 每日5豆26天88豆
'9BABD41E5674FD5791963D5366BEC634', // 每日1豆5天10豆21天100豆;
'EFFD0BF4069A8B6882A55FB07ACDA60F', // 10天30豆20天60豆30天100豆;
];
//IOS等用户直接用NobyDa的jd cookie
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item]);
});
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
} else {
let cookiesData = $.getdata('CookiesJD') || '[]';
cookiesData = jd_helpers.jsonParse(cookiesData);
cookiesArr = cookiesData.map((item) => item.cookie);
cookiesArr.reverse();
cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
cookiesArr.reverse();
cookiesArr = cookiesArr.filter((item) => item !== '' && item !== null && item !== undefined);
}
!(async () => {
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { 'open-url': 'https://bean.m.jd.com/bean/signIndex.action' });
return;
}
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]);
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
message = '';
await TotalBean();
console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
'open-url': 'https://bean.m.jd.com/bean/signIndex.action',
});
if ($.isNode()) {
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
}
continue;
}
await dpqd();
if (i < 1) {
await showMsg();
}
}
}
})()
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '');
})
.finally(() => {
$.done();
});
//开始店铺签到
async function dpqd() {
for (var j = 0; j < token.length; j++) {
num = j + 1;
if (token[j] == '') {
continue;
}
await getvenderId(token[j]);
if (vender == '') {
continue;
}
await getvenderName(vender);
await getActivityInfo(token[j], vender);
await signCollectGift(token[j], vender, activityId);
await taskUrl(token[j], vender);
}
}
//获取店铺ID
function getvenderId(token) {
return new Promise((resolve) => {
const options = {
url: `https://api.m.jd.com/api?appid=interCenter_shopSign&t=${Date.now()}&loginType=2&functionId=interact_center_shopSign_getActivityInfo&body={%22token%22:%22${token}%22,%22venderId%22:%22%22}&jsonp=jsonp1000`,
headers: {
accept: '*/*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
cookie: cookie,
referer: 'https://h5.m.jd.com/',
'User-Agent': `Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 8 Build/QKQ1.190828.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.147 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.5.40`,
},
};
$.get(options, (err, resp, data) => {
try {
if (err) {
console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
$.logErr(err);
} else {
//console.log(data)
data = JSON.parse(/{(.*)}/g.exec(data)[0]);
if (data.code == 402) {
vender = '';
console.log(`` + num + `个店铺签到活动已失效`);
message += `` + num + `个店铺签到活动已失效\n`;
} else {
vender = data.data.venderId;
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
}
});
});
}
//获取店铺名称
function getvenderName(venderId) {
return new Promise((resolve) => {
const options = {
url: `https://wq.jd.com/mshop/QueryShopMemberInfoJson?venderId=${venderId}`,
headers: {
accept: '*/*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
cookie: cookie,
'User-Agent': `Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 8 Build/QKQ1.190828.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.147 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.5.40`,
},
};
$.get(options, (err, resp, data) => {
try {
if (err) {
console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
$.logErr(err);
} else {
//console.log(data)
data = JSON.parse(data);
shopName = data.shopName;
console.log(`` + shopName + ``);
message += `` + shopName + ``;
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
}
});
});
}
//获取店铺活动信息
function getActivityInfo(token, venderId) {
return new Promise((resolve) => {
const options = {
url: `${JD_API_HOST}&t=${Date.now()}&loginType=2&functionId=interact_center_shopSign_getActivityInfo&body={%22token%22:%22${token}%22,%22venderId%22:${venderId}}&jsonp=jsonp1005`,
headers: {
accept: 'accept',
'accept-encoding': 'gzip, deflate',
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
cookie: cookie,
referer: `https://h5.m.jd.com/babelDiy/Zeus/2PAAf74aG3D61qvfKUM5dxUssJQ9/index.html?token=${token}&sceneval=2&jxsid=16178634353215523301&cu=true&utm_source=kong&utm_medium=jingfen&utm_campaign=t_2009753434_&utm_term=fa3f8f38c56f44e2b4bfc2f37bce9713`,
'User-Agent': `Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 8 Build/QKQ1.190828.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.147 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.5.40`,
},
};
$.get(options, (err, resp, data) => {
try {
if (err) {
// console.log(data)
console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
$.logErr(err);
} else {
//console.log(data)
data = JSON.parse(/{(.*)}/g.exec(data)[0]);
activityId = data.data.id;
//console.log(data)
let mes = '';
for (let i = 0; i < data.data.continuePrizeRuleList.length; i++) {
const level = data.data.continuePrizeRuleList[i].level;
const discount = data.data.continuePrizeRuleList[i].prizeList[0].discount;
mes += '签到' + level + '天,获得' + discount + '豆';
}
//console.log(message+mes+'\n')
//message += mes+'\n'
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
}
});
});
}
//店铺签到
function signCollectGift(token, venderId, activitytemp) {
return new Promise((resolve) => {
const options = {
url: `${JD_API_HOST}&t=${Date.now()}&loginType=2&functionId=interact_center_shopSign_signCollectGift&body={%22token%22:%22${token}%22,%22venderId%22:688200,%22activityId%22:${activitytemp},%22type%22:56,%22actionType%22:7}&jsonp=jsonp1004`,
headers: {
accept: 'accept',
'accept-encoding': 'gzip, deflate',
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
cookie: cookie,
referer: `https://h5.m.jd.com/babelDiy/Zeus/2PAAf74aG3D61qvfKUM5dxUssJQ9/index.html?token=${token}&sceneval=2&jxsid=16178634353215523301&cu=true&utm_source=kong&utm_medium=jingfen&utm_campaign=t_2009753434_&utm_term=fa3f8f38c56f44e2b4bfc2f37bce9713`,
'User-Agent': `Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 8 Build/QKQ1.190828.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.147 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.5.40`,
},
};
$.get(options, (err, resp, data) => {
try {
if (err) {
console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
$.logErr(err);
} else {
//console.log(data)
data = JSON.parse(/{(.*)}/g.exec(data)[0]);
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
}
});
});
}
//店铺获取签到信息
function taskUrl(token, venderId) {
return new Promise((resolve) => {
const options = {
url: `${JD_API_HOST}&t=${Date.now()}&loginType=2&functionId=interact_center_shopSign_getSignRecord&body={%22token%22:%22${token}%22,%22venderId%22:${venderId},%22activityId%22:${activityId},%22type%22:56}&jsonp=jsonp1006`,
headers: {
accept: 'application/json',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9',
cookie: cookie,
referer: `https://h5.m.jd.com/`,
'user-agent': `Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 8 Build/QKQ1.190828.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.147 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.5.40`,
},
};
$.get(options, (err, resp, data) => {
try {
if (err) {
console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
$.logErr(err);
} else {
//console.log(data)
data = JSON.parse(/{(.*)}/g.exec(data)[0]);
console.log(`已签到:` + data.data.days + ``);
message += `已签到:` + data.data.days + `\n`;
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
}
});
});
}
async function showMsg() {
if ($.isNode() && !process.env.SHOP_SIGN_NOTIFY_CONTROL) {
$.msg($.name, '', `【京东账号${$.index}${$.nickName}\n${message}`);
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}${$.nickName}\n${message}`);
}
}
function TotalBean() {
return new Promise(async (resolve) => {
const options = {
url: `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
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,
Referer: 'https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2',
'User-Agent': `jdapp;android;9.3.5;10;3353234393134326-3673735303632613;network/wifi;model/MI 8;addressid/138719729;aid/3524914bc77506b1;oaid/274aeb3d01b03a22;osVer/29;appBuild/86390;psn/Mp0dlaZf4czQtfPNMEfpcYU9S/f2Vv4y|2255;psq/1;adk/;ads/;pap/JA2015_311210|9.3.5|ANDROID 10;osv/10;pv/2039.1;jdv/0|androidapp|t_335139774|appshare|QQfriends|1611211482018|1611211495;ref/com.jingdong.app.mall.home.JDHomeFragment;partner/jingdong;apprpd/Home_Main;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36`,
},
};
$.post(options, (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`);
console.log(`${$.name} API请求失败请检查网路重试`);
} else {
if (data) {
data = JSON.parse(data);
if (data['retcode'] === 13) {
$.isLogin = false; //cookie过期
return;
}
$.nickName = (data['base'] && data['base'].nickname) || $.UserName;
} else {
console.log(`京东服务器返回空数据`);
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}

File diff suppressed because one or more lines are too long