加入守护星抽奖功能

This commit is contained in:
wisz2021
2021-05-31 09:56:10 +08:00
parent 16abf076fa
commit 1dc54cf10a

View File

@ -1,6 +1,6 @@
/* /*
家电星推官脚本 家电星推官脚本
Last Modified time: 2021-05-27 18:15:04 Last Modified time: 2021-05-31 9:15:04
家电星推官活动地址https://3.cn/-1eD1VOa?_ts=1622072397979&utm_source=iosapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=CopyURL&ad_od=share&gx=RnFtxGZZPTONndRP--twDLBLeC4DoX3_2wf2 家电星推官活动地址https://3.cn/-1eD1VOa?_ts=1622072397979&utm_source=iosapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=CopyURL&ad_od=share&gx=RnFtxGZZPTONndRP--twDLBLeC4DoX3_2wf2
活动时间2021年5月27日 00:00:00-2021年6月18日 23:59:59 活动时间2021年5月27日 00:00:00-2021年6月18日 23:59:59
京豆先到先得!!!!!!!!!!! 京豆先到先得!!!!!!!!!!!
@ -108,6 +108,7 @@ const JD_API_HOST = "https://guardianstarjd.m.jd.com/star";
$.j = index; $.j = index;
$.times = 0; $.times = 0;
await JD_XTG(true); await JD_XTG(true);
await indexInfo();//抽奖
} }
await showMsg(); await showMsg();
} }
@ -390,6 +391,58 @@ function doSupport(shareId) {
}); });
}); });
} }
function indexInfo() {
return new Promise(async (resolve) => {
const options = taskPostUrl('index/indexInfo', 'indexInfo', `starId=${$.activeId}&type=null`);
$.post(options, async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`);
console.log(`${$.name} API请求失败请检查网路重试`);
} else {
data = JSON.parse(data);
if (data && data.code === 200) {
$.starPrizeVoList = (data.data.starPrizeVoList || []).filter(vo => vo.status === 0 && data.data.myTotalStar >= vo['starGradeNum']);
for (let item of $.starPrizeVoList) {
await lottery(item['id']);
// await $.wait(500);
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
function lottery(id) {
return new Promise(async (resolve) => {
const options = taskPostUrl('task/lottery', 'lottery', `starId=${$.activeId}&id=${id}`);
$.post(options, (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`);
console.log(`${$.name} API请求失败请检查网路重试`);
} else {
data = JSON.parse(data);
if (data && data.code === 200) {
if (data.data && data.data.status === 1) {
console.log(`京东账号${$.index} ${$.nickName || $.UserName}恭喜中奖\n${$.activeId}】星推官抽奖详情${JSON.stringify(data)}\n`);
} else {
console.log(`${$.activeId}】星推官抽奖:未中奖\n`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
function TotalBean() { function TotalBean() {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const options = { const options = {