1
0
mirror of https://github.com/okyyds/yyds.git synced 2026-07-14 00:31:18 +08:00

Update jd_bean_change.js

This commit is contained in:
YYDS
2022-02-17 17:38:29 +08:00
parent a9202241e5
commit e8fe13369b

View File

@@ -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)}`)
@@ -1184,10 +1182,10 @@ 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',
@@ -1200,14 +1198,13 @@ function apptaskUrl(url, body) {
} }
} }
} }
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))]
@@ -1218,19 +1215,19 @@ function getSign(functionid, body, uuid) {
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: 15000 timeout: 30 * 1000
} }
$.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))
isSignError = true; console.log(`${$.name} getSign API请求失败请检查网路重试`)
//console.log(`${$.name} getSign API请求失败请检查网路重试`) } else {
} else {}
}
} catch (e) { } catch (e) {
$.logErr(e, resp) $.logErr(e, resp)
} } finally {
finally {
resolve(data); resolve(data);
} }
}) })