From 17d3dacb31e09cc7cc07cdc851a3e93e89f7a0eb Mon Sep 17 00:00:00 2001 From: anonymous Date: Wed, 13 Jan 2021 10:20:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B4=E8=B4=A7=E8=8A=82=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=8A=BD=E5=A5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_nh.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/jd_nh.js b/jd_nh.js index 5d394a8b..6e8859e5 100644 --- a/jd_nh.js +++ b/jd_nh.js @@ -95,6 +95,11 @@ async function jdNh() { await getMyPing() await getUserInfo() await getActContent(false,shareUuid) + await getActContent(true) + if($.userInfo.score>=5000){ + console.log(`大于5000金币,去抽奖`) + await draw() + } await showMsg(); } @@ -376,7 +381,7 @@ function getTaskInfo(taskType, value) { }) } -// 做任务 +// 完成任务 function doTask(taskType, value) { let body = `activityId=${ACT_ID}&pin=${encodeURIComponent($.pin)}&actorUuid=${$.actorUuid}&taskType=${taskType}&taskValue=${value}` return new Promise(resolve => { @@ -412,6 +417,35 @@ function showMsg() { 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) { return { url: `https://lzdz-isv.isvjcloud.com/${function_id}?${body}`,