Update jd_bean_change.js
parent
935697fe4d
commit
8db7073319
|
@ -1135,22 +1135,21 @@ async function Monthbean() {
|
||||||
|
|
||||||
async function jdCash() {
|
async function jdCash() {
|
||||||
let functionId = "cash_homePage";
|
let functionId = "cash_homePage";
|
||||||
let body = "%7B%7D";
|
let body = {};
|
||||||
let uuid = randomString(16);
|
|
||||||
console.log(`正在获取领现金任务签名...`);
|
console.log(`正在获取领现金任务签名...`);
|
||||||
isSignError = false;
|
isSignError = false;
|
||||||
let sign = await getSign(functionId, decodeURIComponent(body), uuid)
|
let sign = await getSign(functionId, body);
|
||||||
if (isSignError) {
|
if (isSignError) {
|
||||||
console.log(`领现金任务签名获取失败,等待2秒后再次尝试...`)
|
console.log(`领现金任务签名获取失败,等待2秒后再次尝试...`)
|
||||||
await $.wait(2 * 1000);
|
await $.wait(2 * 1000);
|
||||||
isSignError = false;
|
isSignError = false;
|
||||||
sign = await getSign(functionId, decodeURIComponent(body), uuid);
|
sign =await getSign(functionId, body);
|
||||||
}
|
}
|
||||||
if (isSignError) {
|
if (isSignError) {
|
||||||
console.log(`领现金任务签名获取失败,等待2秒后再次尝试...`)
|
console.log(`领现金任务签名获取失败,等待2秒后再次尝试...`)
|
||||||
await $.wait(2 * 1000);
|
await $.wait(2 * 1000);
|
||||||
isSignError = false;
|
isSignError = false;
|
||||||
sign = await getSign(functionId, decodeURIComponent(body), uuid);
|
sign = await getSign(functionId, body);
|
||||||
}
|
}
|
||||||
if (!isSignError) {
|
if (!isSignError) {
|
||||||
console.log(`领现金任务签名获取成功...`)
|
console.log(`领现金任务签名获取成功...`)
|
||||||
|
@ -1159,9 +1158,8 @@ async function jdCash() {
|
||||||
$.jdCash = 0;
|
$.jdCash = 0;
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let url = `${JD_API_HOST}?functionId=${functionId}&build=167774&client=apple&clientVersion=10.1.0&uuid=${uuid}&${sign}`
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
$.post(apptaskUrl(url, body), async(err, resp, data) => {
|
$.post(apptaskUrl(functionId, sign), async (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(`${JSON.stringify(err)}`)
|
console.log(`${JSON.stringify(err)}`)
|
||||||
|
@ -1170,7 +1168,7 @@ async function jdCash() {
|
||||||
if (safeGet(data)) {
|
if (safeGet(data)) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
if (data.code === 0 && data.data.result) {
|
if (data.code === 0 && data.data.result) {
|
||||||
$.jdCash = data.data.result.totalMoney || 0;
|
$.jdCash = data.data.result.totalMoney || 0;
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1184,57 +1182,56 @@ async function jdCash() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function apptaskUrl(url, body) {
|
function apptaskUrl(functionId = "", body = "") {
|
||||||
return {
|
return {
|
||||||
url,
|
url: `${JD_API_HOST}?functionId=${functionId}`,
|
||||||
body: `body=${body}`,
|
body,
|
||||||
headers: {
|
headers: {
|
||||||
'Cookie': cookie,
|
'Cookie': cookie,
|
||||||
'Host': 'api.m.jd.com',
|
'Host': 'api.m.jd.com',
|
||||||
'Connection': 'keep-alive',
|
'Connection': 'keep-alive',
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Referer': '',
|
'Referer': '',
|
||||||
'User-Agent': 'JD4iPhone/167774 (iPhone; iOS 14.7.1; Scale/3.00)',
|
'User-Agent': 'JD4iPhone/167774 (iPhone; iOS 14.7.1; Scale/3.00)',
|
||||||
'Accept-Language': 'zh-Hans-CN;q=1',
|
'Accept-Language': 'zh-Hans-CN;q=1',
|
||||||
'Accept-Encoding': 'gzip, deflate, br',
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function getSign(functionid, body, uuid) {
|
function getSign(functionId, body) {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
let data = {
|
let data = {
|
||||||
"functionId": functionid,
|
functionId,
|
||||||
"body": body,
|
body: JSON.stringify(body),
|
||||||
"uuid": uuid,
|
"client":"apple",
|
||||||
"client": "apple",
|
"clientVersion":"10.3.0"
|
||||||
"clientVersion": "10.1.0"
|
}
|
||||||
}
|
let HostArr = ['jdsign.cf', 'signer.nz.lu']
|
||||||
let HostArr = ['jdsign.cf', 'signer.nz.lu']
|
let Host = HostArr[Math.floor((Math.random() * HostArr.length))]
|
||||||
let Host = HostArr[Math.floor((Math.random() * HostArr.length))]
|
let options = {
|
||||||
let options = {
|
url: `https://cdn.nz.lu/ddo`,
|
||||||
url: `https://cdn.nz.lu/ddo`,
|
body: JSON.stringify(data),
|
||||||
body: JSON.stringify(data),
|
headers: {
|
||||||
headers: {
|
Host,
|
||||||
Host,
|
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
|
||||||
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
|
},
|
||||||
},
|
timeout: 30 * 1000
|
||||||
timeout: 15000
|
}
|
||||||
}
|
$.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} getSign API请求失败,请检查网路重试`)
|
||||||
isSignError = true;
|
} else {
|
||||||
//console.log(`${$.name} getSign API请求失败,请检查网路重试`)
|
|
||||||
} else {}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$.logErr(e, resp)
|
$.logErr(e, resp)
|
||||||
}
|
} finally {
|
||||||
finally {
|
resolve(data);
|
||||||
resolve(data);
|
}
|
||||||
}
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
function TotalBean() {
|
function TotalBean() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
|
Loading…
Reference in New Issue