年货节自动抽奖

This commit is contained in:
anonymous
2021-01-13 10:20:41 +08:00
parent 6e3dcda83a
commit 17d3dacb31

View File

@@ -95,6 +95,11 @@ async function jdNh() {
await getMyPing() await getMyPing()
await getUserInfo() await getUserInfo()
await getActContent(false,shareUuid) await getActContent(false,shareUuid)
await getActContent(true)
if($.userInfo.score>=5000){
console.log(`大于5000金币去抽奖`)
await draw()
}
await showMsg(); await showMsg();
} }
@@ -376,7 +381,7 @@ function getTaskInfo(taskType, value) {
}) })
} }
// 任务 // 完成任务
function doTask(taskType, value) { function doTask(taskType, value) {
let body = `activityId=${ACT_ID}&pin=${encodeURIComponent($.pin)}&actorUuid=${$.actorUuid}&taskType=${taskType}&taskValue=${value}` let body = `activityId=${ACT_ID}&pin=${encodeURIComponent($.pin)}&actorUuid=${$.actorUuid}&taskType=${taskType}&taskValue=${value}`
return new Promise(resolve => { return new Promise(resolve => {
@@ -412,6 +417,35 @@ function showMsg() {
resolve() resolve()
}) })
} }
//抽奖
function draw() {
let body = `activityId=${ACT_ID}&uuid=${$.actorUuid}&pin=${encodeURIComponent($.pin)}&drawValue=18`
return new Promise(resolve => {
$.post(taskPostUrl('dingzhi/vm/template/start', body), async (err, resp, data) => {
try {
if (err) {
console.log(`${err}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.result && data.data) {
console.log(`抽奖成功,获得 ${data.data.drawInfo || '空气'}`)
message += `抽奖成功,获得 ${data.data.drawInfo || '空气'}`
} else {
console.log(`任务完成失败,错误信息:${data.errorMessage}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function taskUrl(function_id, body) { function taskUrl(function_id, body) {
return { return {
url: `https://lzdz-isv.isvjcloud.com/${function_id}?${body}`, url: `https://lzdz-isv.isvjcloud.com/${function_id}?${body}`,