This commit is contained in:
Faker 2023-08-16 20:52:48 +08:00
parent 03220d450e
commit 96123dcfb3
2 changed files with 40 additions and 414 deletions

View File

@ -1,23 +1,14 @@
/* /*
cron:1 1 1 1 *
============Quantumultx=============== ============Quantumultx===============
[task_local] [task_local]
#玩一玩成就 #玩一玩成就
0 8 * * * jd_wyw.js, tag=玩一玩成就, img-url=https://raw.githubusercontent.com/tsukasa007/icon/master/jd_wyw.png, enabled=true 1 1 1 1 * jd_wyw.js, tag=玩一玩成就, enabled=true
================Loon==============
[Script]
cron "0 8 * * *" script-path=jd_wyw.js,tag=玩一玩成就
===============Surge=================
玩一玩成就 = type=cron,cronexp="0 8 * * *",wake-system=1,timeout=3600,script-path=jd_wyw.js
============小火箭=========
玩一玩成就 = type=cron,script-path=jd_wyw.js, cronexpr="0 8 * * *", timeout=3600, enable=true
*/ */
const $ = new Env('玩一玩成就'); const $ = new Env('玩一玩成就');
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const notify = $.isNode() ? require('./sendNotify') : ''; const notify = $.isNode() ? require('./sendNotify') : '';
//IOS等用户直接用NobyDa的jd cookie //IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], let cookiesArr = [],
@ -35,7 +26,7 @@ $.invitePinTaskList = []
message = "" message = ""
!(async () => { !(async () => {
$.user_agent = require('./USER_AGENTS').USER_AGENT console.log('\n【活动入口京东APP搜索-玩一玩 】\n\n【每次运行活动ID均不同只增加成长值目前没任何收益 】');
if (!cookiesArr[0]) { if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', { $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
"open-url": "https://bean.m.jd.com/" "open-url": "https://bean.m.jd.com/"
@ -50,8 +41,6 @@ message = ""
$.isLogin = true; $.isLogin = true;
$.nickName = ''; $.nickName = '';
console.log(`\n\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`); console.log(`\n\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
if (!$.isLogin) { if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { $.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" "open-url": "https://bean.m.jd.com/bean/signIndex.action"
@ -61,13 +50,15 @@ message = ""
} }
continue continue
} }
await getPlayTaskCenter() await getUA();
await getPlayTaskCenter();
for (const playTaskCenterListElement of $.playTaskCenterList) { for (const playTaskCenterListElement of $.playTaskCenterList) {
$.log(`play ${playTaskCenterListElement.name} 获得成就值: ${playTaskCenterListElement.achieve}`) $.log(`ID${playTaskCenterListElement.playId} ${playTaskCenterListElement.name} 成就值: ${playTaskCenterListElement.achieve}`)
await $.wait(parseInt(Math.random() * 1500 + 3000, 10))
await doPlayAction(playTaskCenterListElement.playId) await doPlayAction(playTaskCenterListElement.playId)
await $.wait(parseInt(Math.random() * 1500 + 3000, 10))
} }
await $.wait(parseInt(Math.random() * 1500 + 2000, 10))
} }
} }
@ -109,6 +100,9 @@ function doPlayAction(playId) {
console.log(`${$.name} API请求失败请检查网路重试`) console.log(`${$.name} API请求失败请检查网路重试`)
} else { } else {
data = JSON.parse(data); data = JSON.parse(data);
if (data) {
console.log('任务完成,总成长值:' + data?.data?.achieve)
}
debugger debugger
} }
} catch (e) { } catch (e) {
@ -120,14 +114,23 @@ function doPlayAction(playId) {
}) })
} }
async function getUA() {
$.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`
}
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 taskPostClientActionUrl(body, functionId) { function taskPostClientActionUrl(body, functionId) {
return { return {
url: `https://api.m.jd.com/client.action?${functionId ? `functionId=${functionId}` : ``}`, url: `https://api.m.jd.com/client.action?${functionId ? `functionId=${functionId}` : ``}`,
body: body, body: body,
headers: { headers: {
'User-Agent':$.user_agent, 'User-Agent': $.UA,
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
'Host': 'api.m.jd.com', 'Host': 'api.m.jd.com',
'Origin': 'https://api.m.jd.com', 'Origin': 'https://api.m.jd.com',

File diff suppressed because one or more lines are too long