From 4fa4f8c4d86cafb23a27bf4723fd2015790827ca Mon Sep 17 00:00:00 2001 From: anonymous Date: Tue, 19 Jan 2021 13:48:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E7=9A=84=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E3=80=81=E9=A2=86=E5=8F=96=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_nian.js | 148 +++++++++++++++++++++++++++++------------------------ 1 file changed, 81 insertions(+), 67 deletions(-) diff --git a/jd_nian.js b/jd_nian.js index 12053ef4..6d3e6495 100644 --- a/jd_nian.js +++ b/jd_nian.js @@ -88,12 +88,18 @@ async function jdNian() { try { await getHomeData() if(!$.secretp) return + await $.wait(2000) + await killCouponList() + await $.wait(2000) await map() + await $.wait(2000) await queryMaterials() await getTaskList() await $.wait(1000) await doTask() + await $.wait(2000) await helpFriends() + await $.wait(2000) await getHomeData(true) await showMsg() } catch (e) { @@ -538,7 +544,11 @@ function queryMaterials() { if (safeGet(data)) { data = JSON.parse(data); if(data.code==='0') { - for(let vo of data.data.viewLogo.list){ + let shopList = data.data.viewLogo.list.concat(data.data.bottomLogo.list) + let nameList = [] + for(let vo of shopList){ + if(nameList.includes(vo.name)) continue + nameList.push(vo.name) console.log(`去做${vo.name}店铺任务`) await shopLotteryInfo(vo.desc) await $.wait(2000) @@ -554,6 +564,7 @@ function queryMaterials() { }) }) } + function shopLotteryInfo(shopSign) { let body = {"shopSign":shopSign} return new Promise(resolve => { @@ -638,72 +649,6 @@ function doShopLottery(shopSign) { }) }) } -function signInRead(shopSign) { - let body = {"shopSign":shopSign} - return new Promise(resolve => { - $.post(taskPostUrl("nian_shopSignInRead", body, "nian_shopSignInRead"), async (err, resp, data) => { - try { - if (err) { - console.log(`${JSON.stringify(err)}`) - console.log(`${$.name} API请求失败,请检查网路重试`) - } else { - if (safeGet(data)) { - data = JSON.parse(data); - if(data.code===0 && data.data && data.data.result && data.data.result.signInTag) { - await signInWrite(shopSign) - } else{ - console.log(`店铺已签到过`) - } - } - } - } catch (e) { - $.logErr(e, resp) - } finally { - resolve(); - } - }) - }) -} -function signInWrite(shopSign) { - let temp = { - "shopSign": shopSign, - } - const extraData = { - "jj": 6, - "buttonid": "jmdd-react-smash_0", - "sceneid": "homePageh5", - "appid": '50073' - } - let body = { - ...encode(temp, $.secretp, extraData), - shopSign:shopSign - } - return new Promise(resolve => { - $.post(taskPostUrl("nian_shopSignInWrite", body, "nian_shopSignInWrite"), async (err, resp, data) => { - try { - if (err) { - console.log(`${JSON.stringify(err)}`) - console.log(`${$.name} API请求失败,请检查网路重试`) - } else { - if (safeGet(data)) { - data = JSON.parse(data); - if (data.data.bizCode === 0) { - if(data.data.result.score) - console.log(`签到成功,获得${data.data.result.score}爆竹🧨`) - } - else{ - console.log(data.data.bizMsg) - } - } - } - } catch (e) { - $.logErr(e, resp) - } finally { - resolve(); - } - }) - }) -} function pkInfo() { return new Promise(resolve => { @@ -803,6 +748,75 @@ function pkAssignGroup(inviteId) { }) }) } +function killCouponList() { + return new Promise(resolve => { + $.post(taskPostUrl("nian_killCouponList", {}, "nian_killCouponList"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data.data && data.data.bizCode === 0) { + await $.wait(2000) + for(let vo of data.data.result){ + if(!vo.status){ + console.log(`去领取${vo['productName']}优惠券`) + await killCoupon(vo['skuId']) + await $.wait(2000) + } + } + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +function killCoupon(skuId) { + let temp = { + "skuId": skuId, + "rnd": getRnd(), + "inviteId": "-1", + "stealId": "-1" + } + const extraData = { + "jj": 6, + "buttonid": "jmdd-react-smash_0", + "sceneid": "homePageh5", + "appid": '50073' + } + let body = encode(temp, $.secretp, extraData); + body['skuId'] = skuId + return new Promise(resolve => { + $.post(taskPostUrl("nian_killCoupon", body, "nian_killCoupon"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data.data && data.data.bizCode === 0) { + console.log(`领取成功,获得${data.data.result.score}爆竹🧨`) + }else{ + console.log(data.data.bizMsg) + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} function readShareCode() { console.log(`开始`) return new Promise(async resolve => {