Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zero205 authored Mar 30, 2021
1 parent 7946834 commit 9ca87fa
Showing 1 changed file with 45 additions and 15 deletions.
60 changes: 45 additions & 15 deletions jd_mohe.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
5G超级盲盒,可抽奖获得京豆,建议在凌晨0点时运行脚本,白天抽奖基本没有京豆,4小时运行一次收集热力值
活动地址: https://isp5g.m.jd.com
活动时间:2021-03-19到2021-04-30
更新时间:2021-03-20 08:55
更新时间:2021-03-30 12:00
脚本兼容: QuantumultX, Surge,Loon, JSBox, Node.js
=================================Quantumultx=========================
[task_local]
Expand All @@ -25,7 +25,7 @@ const notify = $.isNode() ? require('./sendNotify') : '';
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '', message;
let cookiesArr = [], cookie = '', message, allMessage = '';
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
Expand All @@ -51,7 +51,7 @@ $.shareId = [];
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]);
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
Expand All @@ -76,11 +76,11 @@ $.shareId = [];
await getAward();//抽奖
}
}
//ios端22点通知一次
if (new Date().getHours() === 22) {
$.msg($.name, '', `任务已做完\n抽奖详情查看 https://isp5g.m.jd.com`, {"open-url": "https://isp5g.m.jd.com"});
if (allMessage) {
if ($.isNode()) await notify.sendNotify($.name, allMessage);
$.msg($.name, '', allMessage, {"open-url": "https://isp5g.m.jd.com"})
}
await $.http.get({url: `https://code.c-hiang.cn//api/v1/jd/mohe/read/20`, timeout: 10000}).then(async (resp) => {
await $.http.get({url: `https://code.c-hiang.cn//api/v1/jd/mohe/read/1`, timeout: 10000}).then(async (resp) => {
if (resp.statusCode === 200) {
try {
let { body } = resp;
Expand All @@ -92,11 +92,11 @@ $.shareId = [];
console.log(`读取邀请码异常:${e}`)
}
}
});
}).catch((e) => console.log(`catch 读取邀请码异常:${e}`));
for (let v = 0; v < cookiesArr.length; v++) {
cookie = cookiesArr[v];
$.index = v + 1;
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]);
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
console.log(`\n\n自己账号内部互助`);
for (let item of $.shareId) {
console.log(`账号 ${$.index} ${$.UserName} 开始给 ${item}进行助力`)
Expand Down Expand Up @@ -261,6 +261,8 @@ function getCoin() {
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
})
})
Expand Down Expand Up @@ -412,11 +414,15 @@ async function getAward() {
console.log(`====抽奖结果====,${JSON.stringify(lotteryRes.data)}`);
console.log(lotteryRes.data.name);
console.log(lotteryRes.data.beanNum);
if ((lotteryRes.data['prizeId'] && lotteryRes.data['prizeId'] !== '9999') || lotteryRes.data.name === '未中奖') {
message += `抽奖获得:${lotteryRes.data.name}\n`;
}
} else if (lotteryRes.code === 4001) {
console.log(`抽奖失败,${lotteryRes.msg}`);
break;
}
}
if (message) allMessage += `京东账号${$.index} ${$.nickName}\n${message}抽奖详情查看 https://isp5g.m.jd.com/#/myPrize${$.index !== cookiesArr.length ? '\n\n' : ''}`
} else {
console.log(`目前热力值${total},不够抽奖`)
}
Expand Down Expand Up @@ -452,7 +458,7 @@ function lottery() {
"content-type": "application/x-www-form-urlencoded",
"cookie": cookie,
"referer": "https://isp5g.m.jd.com",
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;android;9.4.4;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36")
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
}
}
$.get(options, (err, resp, data) => {
Expand Down Expand Up @@ -480,7 +486,7 @@ function shareUrl() {
"content-type": "application/x-www-form-urlencoded",
"cookie": cookie,
"referer": "https://isp5g.m.jd.com",
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;android;9.4.4;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36")
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
}
}
$.get(options, async (err, resp, data) => {
Expand Down Expand Up @@ -512,12 +518,12 @@ function shareUrl() {
console.log(`邀请码提交异常:${e}`)
}
}
});
}).catch((e) => console.log(`catch 邀请码提交异常:${e}`));
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
resolve();
}
})
})
Expand All @@ -532,16 +538,40 @@ function taskurl(url) {
"content-type": "application/x-www-form-urlencoded",
"cookie": cookie,
"referer": "https://isp5g.m.jd.com",
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;android;9.4.4;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36")
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
}
}
}
function updateShareCodesCDN(url = 'https://gitee.com/lxk0301/updateTeam/raw/master/shareCodes/jd_shareCodes.json') {
return new Promise(resolve => {
$.get({
url ,
timeout: 10000,
headers:{"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")}}, async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
$.updatePkActivityIdRes = JSON.parse(data);
if ($.updatePkActivityIdRes && $.updatePkActivityIdRes.length) {
$.shareId = $.updatePkActivityIdRes;
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function updateShareCodesCDN(url = 'https://cdn.jsdelivr.net/gh/zero205/updateTeam@master/shareCodes/jd_shareCodes.json') {
return new Promise(resolve => {
$.get({
url ,
timeout: 10000,
headers:{"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;android;9.4.4;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36")}}, async (err, resp, data) => {
headers:{"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")}}, async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
Expand Down

0 comments on commit 9ca87fa

Please sign in to comment.