增加积分抽奖
This commit is contained in:
@@ -140,6 +140,7 @@ let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*
|
|||||||
async function JD818() {
|
async function JD818() {
|
||||||
try {
|
try {
|
||||||
await indexInfo();//获取任务
|
await indexInfo();//获取任务
|
||||||
|
await supportList();//助力情况
|
||||||
await getHelp();//获取邀请码
|
await getHelp();//获取邀请码
|
||||||
if ($.blockAccount) return
|
if ($.blockAccount) return
|
||||||
await indexInfo(true);//获取任务
|
await indexInfo(true);//获取任务
|
||||||
@@ -345,8 +346,8 @@ function indexInfo(flag = false) {
|
|||||||
$.brandList = data['data']['brandList'];
|
$.brandList = data['data']['brandList'];
|
||||||
$.browseshopList = data['data']['browseshopList'];
|
$.browseshopList = data['data']['browseshopList'];
|
||||||
if (flag) {
|
if (flag) {
|
||||||
console.log(`助力情况:${data['data']['supportedNums']}/${data['data']['supportNeedNums']}`);
|
// console.log(`助力情况:${data['data']['supportedNums']}/${data['data']['supportNeedNums']}`);
|
||||||
message += `邀请好友助力:${data['data']['supportedNums']}/${data['data']['supportNeedNums']}\n`
|
// message += `邀请好友助力:${data['data']['supportedNums']}/${data['data']['supportNeedNums']}\n`
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(`异常:${JSON.stringify(data)}`)
|
console.log(`异常:${JSON.stringify(data)}`)
|
||||||
@@ -360,7 +361,58 @@ function indexInfo(flag = false) {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
//获取助力信息
|
||||||
|
function supportList() {
|
||||||
|
const options = taskUrl('/khc/index/supportList', { t: Date.now() })
|
||||||
|
return new Promise( (resolve) => {
|
||||||
|
$.get(options, async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
console.log(`${JSON.stringify(err)}`)
|
||||||
|
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.code === 200) {
|
||||||
|
console.log(`助力情况:${data['data']['supportedNums']}/${data['data']['supportNeedNums']}`);
|
||||||
|
message += `邀请好友助力:${data['data']['supportedNums']}/${data['data']['supportNeedNums']}\n`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp);
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//积分抽奖
|
||||||
|
function lottery() {
|
||||||
|
const options = taskUrl('/khc/record/lottery', { t: Date.now() })
|
||||||
|
return new Promise( (resolve) => {
|
||||||
|
$.get(options, async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
console.log(`${JSON.stringify(err)}`)
|
||||||
|
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.code === 200) {
|
||||||
|
if (data.data.prizeId !== 8) {
|
||||||
|
console.log(`积分抽奖获得:${data.data.prizeName}`);
|
||||||
|
message += `积分抽奖获得:${data.data.prizeName}\n`
|
||||||
|
} else {
|
||||||
|
console.log(`积分抽奖结果:${data['data']['prizeName']}}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp);
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
function myRank() {
|
function myRank() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const body = {
|
const body = {
|
||||||
@@ -542,8 +594,11 @@ function getListIntegral() {
|
|||||||
} else {
|
} else {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
if (data.code === 200) {
|
if (data.code === 200) {
|
||||||
$.integralCount = data.data.integralNum;//累计活动积分
|
$.integralCount = data.data.integralNum || 0;//累计活动积分
|
||||||
message += `累计获得积分:${$.integralCount}\n`;
|
message += `累计获得积分:${$.integralCount}\n`;
|
||||||
|
for (let i = 0; i < parseInt($.integralCount / 50); i ++) {
|
||||||
|
await lottery();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(`integralRecord失败:${JSON.stringify(data)}`);
|
console.log(`integralRecord失败:${JSON.stringify(data)}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user