From bfee693b247e952eab161299462a1aa6cce6e99c Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Wed, 23 Dec 2020 16:47:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3joy=E4=B8=8D=E8=A7=82?= =?UTF-8?q?=E7=9C=8B=E5=B9=BF=E5=91=8A=E8=A7=86=E9=A2=91=E5=BE=97=E9=87=91?= =?UTF-8?q?=E5=B8=81=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_crazy_joy_coin.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/jd_crazy_joy_coin.js b/jd_crazy_joy_coin.js index 7766473a..4e73455b 100644 --- a/jd_crazy_joy_coin.js +++ b/jd_crazy_joy_coin.js @@ -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 {