From cc30cec98127c2f8500ca098d63829fa6a4f2af0 Mon Sep 17 00:00:00 2001 From: Faker Date: Sun, 29 Jan 2023 09:28:36 +0800 Subject: [PATCH] Update jd_ppdt.js --- jd_ppdt.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/jd_ppdt.js b/jd_ppdt.js index 45bd303..8ba3df5 100644 --- a/jd_ppdt.js +++ b/jd_ppdt.js @@ -29,6 +29,8 @@ if ($.isNode()) { $.index = i + 1; $.isLogin = true; $.nickName = ''; + $.ban=''; + $.donep=''; $.UA = require('./USER_AGENTS').UARAM(); //await TotalBean(); console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`); @@ -39,12 +41,14 @@ if ($.isNode()) { } continue } + await xxx8(); + await $.wait(1000); await xxx7(); await $.wait(1000); await xxx1(); if ($.ban) { console.log('风控,跳出'); continue }; await $.wait(500); - if ($.done) continue; + if ($.donep) continue; await xxx2(); await $.wait(500); await xxx4(); @@ -102,7 +106,7 @@ async function xxx1() { $.ban = true; } else if (data.data.bizMsg.indexOf('完成') > -1) { console.log(data.data.bizMsg); - $.done = true; + $.donep = true; } else { console.log(data.data.bizMsg); } @@ -379,6 +383,49 @@ async function xxx7() { }) }) } +async function xxx8() { + let opt = { + url: `https://api.m.jd.com/?client=wh5&appid=ProductZ4Brand&functionId=superBrandDoTask&t=1674924479339&body=%7B%22source%22:%22hall_1111%22,%22activityId%22:1012483,%22completionFlag%22:1,%22encryptProjectId%22:%222ZaVyRdxyCFSSt8hwT1h1zMwcPah%22,%22encryptAssignmentId%22:%223WbhiPoeV5qrLsEC1qq8HLnHLRSS%22,%22assignmentType%22:0,%22actionType%22:0%7D`, + headers: { + 'Origin': 'https://prodev.m.jd.com', + 'User-Agent': $.UA, + 'Cookie': cookie + } + } + return new Promise(async (resolve) => { + $.post(opt, async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(` API请求失败,请检查网路重试`) + } else { + data = JSON.parse(data) + if (data.code == 0) { + if (data.data.bizCode == 0) { + if (data.data?.result?.rewards.length != 0) { + if (data.data?.result?.rewards[0].awardType === 3) { + console.log(` 恭喜获得 ${data.data?.result?.rewards[0].beanNum} 京豆`); + } else { + console.log(JSON.stringify(data.data?.result?.rewards)); + } + } else { + console.log(JSON.stringify(data.data?.result)); + } + } else { + console.log(data.data.bizMsg); + } + } else { + console.log(data.msg) + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(data) + } + }) + }) +} function TotalBean() { return new Promise((resolve) => { const options = {