Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zero205 authored Mar 20, 2021
1 parent 840eb6a commit 8a15ec8
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 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-19 18:35
更新时间:2021-03-20 08:55
脚本兼容: QuantumultX, Surge,Loon, JSBox, Node.js
=================================Quantumultx=========================
[task_local]
Expand Down Expand Up @@ -36,8 +36,8 @@ if ($.isNode()) {
}

const JD_API_HOST = 'https://isp5g.m.jd.com';
//邀请码可能一天一变化,先测试
$.shareId = ["8051f482-5619-47d3-8d2e-7b49a1c1675e","27352a8c-365c-408f-83d4-175daeb147f0"];
//邀请码一天一变化,已确定
$.shareId = [];
!(async () => {
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
Expand All @@ -47,6 +47,7 @@ $.shareId = ["8051f482-5619-47d3-8d2e-7b49a1c1675e","27352a8c-365c-408f-83d4-175
$.msg($.name, '活动已结束', `请禁用或删除脚本`);
return
}
await updateShareCodesCDN()
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
Expand Down Expand Up @@ -79,7 +80,7 @@ $.shareId = ["8051f482-5619-47d3-8d2e-7b49a1c1675e","27352a8c-365c-408f-83d4-175
if (new Date().getHours() === 22) {
$.msg($.name, '', `任务已做完\n抽奖详情查看 https://isp5g.m.jd.com`, {"open-url": "https://isp5g.m.jd.com"});
}
await $.http.get({url: `https://code.chiang.fun//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/20`, timeout: 10000}).then(async (resp) => {
if (resp.statusCode === 200) {
try {
let { body } = resp;
Expand All @@ -96,17 +97,17 @@ $.shareId = ["8051f482-5619-47d3-8d2e-7b49a1c1675e","27352a8c-365c-408f-83d4-175
cookie = cookiesArr[v];
$.index = v + 1;
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]);
console.log(`\n\n开始随机互助互助`);
for (let item of $.body || []) {
console.log(`\n\n自己账号内部互助`);
for (let item of $.shareId) {
console.log(`账号 ${$.index} ${$.UserName} 开始给 ${item}进行助力`)
const res = await addShare(item);
if (res && res['code'] === 2005) {
console.log(`次数已用完,跳出助力`)
break
}
}
console.log(`\n\n自己账号内部互助`);
for (let item of $.shareId) {
console.log(`\n\n如果有剩余助力机会则随机互助`);
for (let item of $.body || []) {
console.log(`账号 ${$.index} ${$.UserName} 开始给 ${item}进行助力`)
const res = await addShare(item);
if (res && res['code'] === 2005) {
Expand Down Expand Up @@ -493,14 +494,15 @@ function shareUrl() {
if (data['code'] === 200) {
$.shareId.push(data['data']);
console.log(`\n【京东账号${$.index}${$.nickName || $.UserName})的${$.name}好友互助码】${data['data']}\n`);
await $.http.get({url: `https://code.chiang.fun/autocommit/mohe/insert/${data['data']}`, timeout: 10000}).then((resp) => {
console.log(`此邀请码一天一变化,旧的不可用`)
await $.http.get({url: `https://code.c-hiang.cn/autocommit/mohe/insert/${data['data']}`, timeout: 10000}).then((resp) => {
// console.log('resp', resp)
if (resp.statusCode === 200) {
try {
let { body } = resp;
body = JSON.parse(body);
if (body['code'] === 200) {
console.log(`邀请码${data['data']}}提交成功\n`)
console.log(`\n邀请码【${data['data']}提交成功\n`)
} else if (body['code'] === 400) {
// console.log(`邀请码 【${data['data']}】 已存在\n`)
} else {
Expand Down Expand Up @@ -534,6 +536,30 @@ function taskurl(url) {
}
}
}
function updateShareCodesCDN(url = 'https://ghproxy.com/https://raw.githubusercontent.com/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;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")}}, 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 TotalBean() {
return new Promise(async resolve => {
const options = {
Expand Down

0 comments on commit 8a15ec8

Please sign in to comment.