解决joy不观看广告视频得金币的bug

This commit is contained in:
lxk0301
2020-12-23 16:47:39 +08:00
parent 18f45b77e5
commit bfee693b24

View File

@@ -336,6 +336,7 @@ function buyJoy(joyId) {
data = JSON.parse(data);
if (data.success) {
if (data.data.eventInfo) {
await openBox(data.data.eventInfo.eventType, data.data.eventInfo.eventRecordId)
$.canBuy = false
return
}
@@ -433,8 +434,9 @@ function getCoin() {
})
}
function openBox(boxId) {
let body = {"eventType": "LUCKY_BOX_DROP", "eventRecordId": boxId}
function openBox(eventType = 'LUCKY_BOX_DROP', boxId) {
console.log(`openBox:${eventType}`)
let body = { eventType, "eventRecordId": boxId}
return new Promise(async resolve => {
$.get(taskUrl('crazyJoy_event_getVideoAdvert', JSON.stringify(body)), async (err, resp, data) => {
try {
@@ -447,7 +449,7 @@ function openBox(boxId) {
if (data['success']) {
$.log(`点击幸运盒子成功,剩余观看视频次数:${data.data.advertViewTimes}等待30秒`)
await $.wait(30000)
await rewardBox(boxId)
await rewardBox(eventType, boxId)
}
}
}
@@ -460,8 +462,8 @@ function openBox(boxId) {
})
}
function rewardBox(boxId) {
let body = {"eventType": "LUCKY_BOX_DROP", "eventRecordId": boxId}
function rewardBox(eventType, boxId) {
let body = { eventType, "eventRecordId": boxId}
return new Promise(async resolve => {
$.get(taskUrl('crazyJoy_event_obtainAward', JSON.stringify(body)), async (err, resp, data) => {
try {