Update jd_wish.js

This commit is contained in:
Faker 2022-11-07 11:39:31 +08:00 committed by ooo
parent d3741de495
commit 5dfa9b719b

View File

@ -1,21 +1,7 @@
/*
众筹许愿池
活动入口京东-京东众筹-众筹许愿池
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
===============Quantumultx===============
[task_local]
#众筹许愿池
40 0,2 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_wish.js, tag=众筹许愿池, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
================Loon==============
[Script]
cron "40 0,2 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_wish.js,tag=众筹许愿池
===============Surge=================
众筹许愿池 = type=cron,cronexp="40 0,2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_wish.js
============小火箭=========
众筹许愿池 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_wish.js, cronexpr="40 0,2 * * *", timeout=3600, enable=true
15 12,19 * * * jd_wish.js
*/
const $ = new Env('众筹许愿池');
const notify = $.isNode() ? require('./sendNotify') : '';
@ -26,7 +12,7 @@ let message = '', allMessage = '';
let cookiesArr = [], cookie = '';
const JD_API_HOST = 'https://api.m.jd.com/client.action';
let appIdArr = ["1FVRZxKiD"];
let appNameArr = ["超级转盘"];
let appNameArr = ["超级转盘"];
let appId, appName;
$.shareCode = [];
if ($.isNode()) {
@ -42,10 +28,6 @@ if ($.isNode()) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
return;
}
if(appIdArr.length <= 0) {
console.log(`\n暂无活动~\n`);
return;
}
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
@ -54,7 +36,7 @@ if ($.isNode()) {
$.isLogin = true;
$.nickName = '';
message = '';
//await TotalBean();
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"});
@ -64,7 +46,6 @@ if ($.isNode()) {
}
continue
}
for (let j = 0; j < appIdArr.length; j++) {
appId = appIdArr[j]
appName = appNameArr[j]
@ -77,7 +58,12 @@ if ($.isNode()) {
if ($.isNode()) await notify.sendNotify($.name, allMessage);
$.msg($.name, '', allMessage)
}
let res = await getAuthorShareCode('https://gitee.com/KingRan521/JD-Scripts/raw/master/shareCodes/wish.json')
let res = await getAuthorShareCode('https://cdn.jsdelivr.net/gh/6dylan6/updateTeam@main/shareCodes/wish.json')
if (!res) {
$.http.get({url: 'https://cdn.jsdelivr.net/gh/6dylan6/updateTeam@main/shareCodes/wish.json'}).then((resp) => {}).catch((e) => console.log('刷新CDN异常', e));
await $.wait(1000)
res = await getAuthorShareCode('https://cdn.jsdelivr.net/gh/6dylan6/updateTeam@main/shareCodes/wish.json')
}
$.shareCode = [...$.shareCode, ...(res || [])]
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
@ -118,9 +104,7 @@ if ($.isNode()) {
})
async function jd_wish() {
try {
$.hasEnd = false;
await healthyDay_getHomeData();
if($.hasEnd) return;
await $.wait(2000)
let getHomeDataRes = (await healthyDay_getHomeData(false)).data.result.userInfo
@ -136,12 +120,9 @@ async function jd_wish() {
$.canLottery = true
for (let j = 0; j < forNum && $.canLottery; j++) {
await interact_template_getLotteryResult()
if (j == 9 && $.canLottery) {
console.log('抽太多次了,下次再继续吧!');
break
}
await $.wait(2000)
}
if (message) allMessage += `京东账号${$.index} ${$.nickName || $.UserName}\n${appName}\n${message}${$.index !== cookiesArr.length ? '\n\n' : ''}`
} catch (e) {
$.logErr(e)
@ -150,7 +131,6 @@ async function jd_wish() {
async function healthyDay_getHomeData(type = true) {
return new Promise(async resolve => {
// console.log(taskUrl('healthyDay_getHomeData', { "appId": appId, "taskToken": "", "channelId": 1 }));
$.post(taskUrl('healthyDay_getHomeData', { "appId": appId, "taskToken": "", "channelId": 1 }), async (err, resp, data) => {
try {
if (err) {
@ -159,8 +139,6 @@ async function healthyDay_getHomeData(type = true) {
} else {
if (safeGet(data)) {
data = JSON.parse(data);
// console.log(data);
if(data.data.bizCode === 0) {
if (type) {
for (let key of Object.keys(data.data.result.hotTaskVos).reverse()) {
let vo = data.data.result.hotTaskVos[key]
@ -203,7 +181,7 @@ async function healthyDay_getHomeData(type = true) {
await harmony_collectScore({ "appId": appId, "taskToken": productInfoVos.taskToken, "taskId": vo.taskId, "actionType": "0" })
}
}
} else if (vo.taskType === 3) {
} else if (vo.taskType === 3 && vo.shoppingActivityVos) {
for (let key of Object.keys(vo.shoppingActivityVos)) {
let shoppingActivityVos = vo.shoppingActivityVos[key]
if (shoppingActivityVos.status !== 2) {
@ -251,10 +229,6 @@ async function healthyDay_getHomeData(type = true) {
}
}
}
} else {
console.log(`黑号,火爆了\n`)
$.hasEnd = true;
}
}
}
} catch (e) {