This commit is contained in:
Faker
2022-04-18 11:08:12 +08:00
parent 1a0cc92eed
commit 1ce009814b
23 changed files with 2915 additions and 904 deletions

View File

@@ -49,7 +49,6 @@ $.log(`最大化收益模式: 已${$.JOY_COIN_MAXIMIZE ? `默认开启` : `关
const JD_API_HOST = `https://api.m.jd.com/client.action`;
message = ""
!(async () => {
$.user_agent = require('./USER_AGENTS').USER_AGENT
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
"open-url": "https://bean.m.jd.com/"
@@ -68,11 +67,13 @@ message = ""
// }
cookie = cookiesArr[i];
if (cookie) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
$.maxJoyCount = 10
$.maxJoyCount = 10;
$.UA = `jdapp;iPhone;10.1.4;13.1.2;${randomString(40)};network/wifi;model/iPhone8,1;addressid/2308460611;appBuild/167814;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 13_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1`
await TotalBean();
if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
@@ -505,7 +506,7 @@ function taskPostClientActionUrl(body, functionId) {
url: `https://api.m.jd.com/client.action?${functionId ? `functionId=${functionId}` : ``}`,
body: body,
headers: {
'User-Agent': $.user_agent,
'User-Agent': $.UA,
'Content-Type': 'application/x-www-form-urlencoded',
'Host': 'api.m.jd.com',
'Origin': 'https://joypark.jd.com',
@@ -520,7 +521,7 @@ function taskGetClientActionUrl(body, functionId) {
url: `https://api.m.jd.com/client.action?functionId=${functionId}${body ? `&${body}` : ``}`,
// body: body,
headers: {
'User-Agent': $.user_agent,
'User-Agent': $.UA,
'Content-Type': 'application/x-www-form-urlencoded',
'Host': 'api.m.jd.com',
'Origin': 'https://joypark.jd.com',
@@ -542,7 +543,7 @@ function TotalBean() {
"Connection": "keep-alive",
"Cookie": cookie,
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Mobile/15E148 Safari/604.1"
"User-Agent": $.UA
}
}
$.post(options, (err, resp, data) => {
@@ -574,7 +575,13 @@ function TotalBean() {
})
})
}
function randomString(e) {
e = e || 32;
let t = "abcdef0123456789", a = t.length, n = "";
for (i = 0; i < e; i++)
n += t.charAt(Math.floor(Math.random() * a));
return n
}
function jsonParse(str) {
if (typeof str == "string") {
try {