This commit is contained in:
lxk0301
2020-12-12 16:58:05 +08:00
parent d1bd7711c5
commit 78d4affba5
3 changed files with 37 additions and 127 deletions

View File

@ -46,7 +46,8 @@ if ($.isNode()) {
const JD_API_HOST = 'https://api.m.jd.com/';
!(async () => {
$.newShareCodes = []
await getAuthorShareCode()
await getAuthorShareCode();
await getAuthorShareCode2();
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
return;
@ -85,7 +86,20 @@ const JD_API_HOST = 'https://api.m.jd.com/';
}
if (helpAuthor && $.authorCode) {
console.log(`去帮助作者`)
await help($.authorCode[0], $.authorCode[1])
const helpRes = await help($.authorCode[0], $.authorCode[1])
if (helpRes && helpRes.data.respCode === 'SG209') {
console.log(`助力次数已耗尽,跳出助力`)
break;
}
}
if (helpAuthor && $.authorCode2) {
for (let code of $.authorCode2) {
const helpRes = await help(code.shareCode, code.groupCode);
if (helpRes && helpRes.data.respCode === 'SG209') {
console.log(`助力次数已耗尽,跳出助力`)
break;
}
}
}
}
}
@ -121,7 +135,26 @@ function getAuthorShareCode() {
})
})
}
function getAuthorShareCode2() {
return new Promise(resolve => {
$.get({url: "https://gitee.com/lxk0301/updateTeam/raw/master/jd_updateBeanHome.json",headers:{
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
}}, async (err, resp, data) => {
try {
if (err) {
} else {
if (safeGet(data)) {
$.authorCode2 = JSON.parse(data);
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function getUserInfo() {
return new Promise(resolve => {
$.post(taskUrl('signBeanGroupStageIndex', 'body'), async (err, resp, data) => {
@ -219,7 +252,7 @@ function help(shareCode, groupCode, isTask = 0) {
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
resolve(data);
}
})
})