优化首页超级摇一摇
This commit is contained in:
@@ -26,7 +26,6 @@ cron "5 0,23 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = new Env('摇京豆');
|
const $ = new Env('摇京豆');
|
||||||
let superShakeUlr = '';//超级摇一摇活动链接
|
|
||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||||
@@ -41,7 +40,12 @@ if ($.isNode()) {
|
|||||||
} else {
|
} else {
|
||||||
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
||||||
}
|
}
|
||||||
$.superShakeBeanFlag = false;
|
let superShakeBeanConfig = {
|
||||||
|
"superShakeUlr": "",//超级摇一摇活动链接
|
||||||
|
"superShakeBeanFlag": false,
|
||||||
|
"superShakeTitle": "",
|
||||||
|
"taskVipName": "",
|
||||||
|
}
|
||||||
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
||||||
!(async () => {
|
!(async () => {
|
||||||
if (!cookiesArr[0]) {
|
if (!cookiesArr[0]) {
|
||||||
@@ -49,7 +53,7 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await welcomeHome()
|
await welcomeHome()
|
||||||
await getActInfo(superShakeUlr);
|
if (superShakeBeanConfig['superShakeUlr']) await getActInfo(superShakeBeanConfig['superShakeUlr']);
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
for (let i = 0; i < cookiesArr.length; i++) {
|
||||||
if (cookiesArr[i]) {
|
if (cookiesArr[i]) {
|
||||||
cookie = cookiesArr[i];
|
cookie = cookiesArr[i];
|
||||||
@@ -79,11 +83,11 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
|||||||
if (allMessage) {
|
if (allMessage) {
|
||||||
if ($.isNode()) await notify.sendNotify($.name, allMessage);
|
if ($.isNode()) await notify.sendNotify($.name, allMessage);
|
||||||
}
|
}
|
||||||
if ($.superShakeBeanFlag) {
|
if (superShakeBeanConfig.superShakeBeanFlag) {
|
||||||
const scaleUl = { "category": "jump", "des": "m", "url": superShakeUlr };
|
const scaleUl = { "category": "jump", "des": "m", "url": superShakeBeanConfig['superShakeUlr'] };
|
||||||
const openjd = `openjd://virtual?params=${encodeURIComponent(JSON.stringify(scaleUl))}`;
|
const openjd = `openjd://virtual?params=${encodeURIComponent(JSON.stringify(scaleUl))}`;
|
||||||
if ($.isNode()) await notify.sendNotify($.name, `【超级摇一摇】活动再次开启\n【开通会员】如需做此任务,请点击链接直达活动页面\n${superShakeUlr}`, { url: openjd });
|
if ($.isNode()) await notify.sendNotify($.name, `【${superShakeBeanConfig['superShakeTitle']}】活动再次开启\n【${superShakeBeanConfig['taskVipName'] || '开通会员'}】如需做此任务,请点击链接直达活动页面\n${superShakeBeanConfig['superShakeUlr']}`, { url: openjd });
|
||||||
$.msg($.name, '', `【超级摇一摇】活动再次开启\n【开通会员】如需做此任务,请点击弹窗直达活动页面`, { 'open-url': openjd })
|
$.msg($.name, superShakeBeanConfig['superShakeTitle'], `【超级摇一摇】活动再次开启\n【${superShakeBeanConfig['taskVipName'] || '开通会员'}】如需做此任务,请点击弹窗直达活动页面`, { 'open-url': openjd })
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
@@ -424,8 +428,8 @@ function welcomeHome() {
|
|||||||
if (data['floorList'] && data['floorList'].length) {
|
if (data['floorList'] && data['floorList'].length) {
|
||||||
const jump = data['floorList'].filter(vo => !!vo && vo.type === 'shakeFloorNew')[0]['jump'];
|
const jump = data['floorList'].filter(vo => !!vo && vo.type === 'shakeFloorNew')[0]['jump'];
|
||||||
if (jump && jump.params && jump['params']['url']) {
|
if (jump && jump.params && jump['params']['url']) {
|
||||||
superShakeUlr = jump.params.url;
|
superShakeBeanConfig['superShakeUlr'] = jump.params.url;
|
||||||
console.log(`【超级摇一摇】活动链接:${superShakeUlr}`);
|
console.log(`【超级摇一摇】活动链接:${superShakeBeanConfig['superShakeUlr']}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -438,7 +442,7 @@ function welcomeHome() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function getActInfo(url= 'https://h5.m.jd.com/babelDiy/Zeus/2GXPFfQmeLgzZuQCWFZWCtwUqro5/index.html') {
|
function getActInfo(url) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
$.get({
|
$.get({
|
||||||
url,
|
url,
|
||||||
@@ -456,9 +460,10 @@ function getActInfo(url= 'https://h5.m.jd.com/babelDiy/Zeus/2GXPFfQmeLgzZuQCWFZW
|
|||||||
data = data && data.match(/window\.__FACTORY__TAOYIYAO__STATIC_DATA__ = (.*)}/)
|
data = data && data.match(/window\.__FACTORY__TAOYIYAO__STATIC_DATA__ = (.*)}/)
|
||||||
if (data) {
|
if (data) {
|
||||||
data = JSON.parse(data[1] + '}');
|
data = JSON.parse(data[1] + '}');
|
||||||
|
if (data['pageConfig']) superShakeBeanConfig['superShakeTitle'] = data['pageConfig']['htmlTitle'];
|
||||||
if (data['taskConfig']) {
|
if (data['taskConfig']) {
|
||||||
$.ActInfo = data['taskConfig']['taskAppId'];
|
$.ActInfo = data['taskConfig']['taskAppId'];
|
||||||
console.log(`\n获取京东APP首页超级摇一摇活动ID成功:${$.ActInfo}\n`);
|
console.log(`\n获取【${superShakeBeanConfig['superShakeTitle']}】活动ID成功:${$.ActInfo}\n`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -486,14 +491,12 @@ function fc_getHomeData(appId, flag = false) {
|
|||||||
if (data) {
|
if (data) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
if (data && data['data']['bizCode'] === 0) {
|
if (data && data['data']['bizCode'] === 0) {
|
||||||
|
const taskVos = data['data']['result']['taskVos'] || [];
|
||||||
if (flag && $.index === 1) {
|
if (flag && $.index === 1) {
|
||||||
$.superShakeBeanFlag = true;
|
superShakeBeanConfig['superShakeBeanFlag'] = true;
|
||||||
// const scaleUl = { "category": "jump", "des": "m", "url": superShakeUlr };
|
superShakeBeanConfig['taskVipName'] = taskVos.filter(vo => !!vo && vo['taskType'] === 21)[0]['taskName'];
|
||||||
// const openjd = `openjd://virtual?params=${encodeURIComponent(JSON.stringify(scaleUl))}`;
|
|
||||||
// if ($.isNode()) await notify.sendNotify($.name, `京东APP首页超级摇一摇再次开启\n如需做开通会员任务,请点击链接直达活动页面\n${superShakeUlr}`, { url: openjd });
|
|
||||||
// $.msg($.name, '', `京东APP首页超级摇一摇再次开启\n如需做开通会员任务,请点击弹窗直达活动页面`, { 'open-url': openjd })
|
|
||||||
}
|
}
|
||||||
$.taskVos = data['data']['result']['taskVos'].filter(item => !!item && item['status'] === 1) || [];
|
$.taskVos = taskVos.filter(item => !!item && item['status'] === 1) || [];
|
||||||
$.lotteryNum = parseInt(data['data']['result']['lotteryNum']);
|
$.lotteryNum = parseInt(data['data']['result']['lotteryNum']);
|
||||||
$.lotTaskId = parseInt(data['data']['result']['lotTaskId']);
|
$.lotTaskId = parseInt(data['data']['result']['lotTaskId']);
|
||||||
} else if (data && data['data']['bizCode'] === 101) {
|
} else if (data && data['data']['bizCode'] === 101) {
|
||||||
@@ -591,8 +594,8 @@ async function superShakeLottery(appId) {
|
|||||||
await $.wait(1000)
|
await $.wait(1000)
|
||||||
}
|
}
|
||||||
if ($.superShakeBeanNum > 0) {
|
if ($.superShakeBeanNum > 0) {
|
||||||
message += `${message ? '\n' : ''}京东APP首页超级摇一摇:获得${$.superShakeBeanNum}京豆`
|
message += `${message ? '\n' : ''}${superShakeBeanConfig['superShakeTitle']}:获得${$.superShakeBeanNum}京豆`
|
||||||
allMessage += `京东账号${$.index}${$.nickName || $.UserName}\n京东APP首页超级摇一摇:获得${$.superShakeBeanNum}京豆${$.index !== cookiesArr.length ? '\n\n' : ''}`;
|
allMessage += `京东账号${$.index}${$.nickName || $.UserName}\n${superShakeBeanConfig['superShakeTitle']}:获得${$.superShakeBeanNum}京豆${$.index !== cookiesArr.length ? '\n\n' : ''}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function fc_getLottery(appId) {
|
function fc_getLottery(appId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user