From 29304959c57065484f0c5b74d9be6a9538e63130 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Wed, 10 Mar 2021 10:31:24 +0800 Subject: [PATCH] update --- jd_get_share_code.js | 46 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/jd_get_share_code.js b/jd_get_share_code.js index 70d55b85..725cffa9 100644 --- a/jd_get_share_code.js +++ b/jd_get_share_code.js @@ -605,18 +605,58 @@ function getCFD(showInvite = true) { }); }); } +//领现金 +function getJdCash() { + function taskUrl(functionId, body = {}) { + return { + url: `https://api.m.jd.com/client.action?functionId=${functionId}&body=${escape(JSON.stringify(body))}&appid=CashRewardMiniH5Env&appid=9.1.0`, + headers: { + 'Cookie': cookie, + 'Host': 'api.m.jd.com', + 'Connection': 'keep-alive', + 'Content-Type': 'application/json', + 'Referer': 'http://wq.jd.com/wxapp/pages/hd-interaction/index/index', + 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"), + 'Accept-Language': 'zh-cn', + 'Accept-Encoding': 'gzip, deflate, br', + } + } + } + return new Promise((resolve) => { + $.get(taskUrl("cash_mob_home",), 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.result){ + console.log(`【京东账号${$.index}(${$.nickName || $.UserName})签到领现金】${data.data.result.inviteCode}`); + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(data); + } + }) + }) +} async function getShareCode() { console.log(`======账号${$.index}开始======`) + await getJDFruit() + await getJdPet() + await getPlantBean() await getJdFactory() await getJxFactory() await getJxNc() - await getJdPet() - await getPlantBean() - await getJDFruit() await getJdZZ() await getJoy() await getSgmh() await getCFD() + await getJdCash() console.log(`======账号${$.index}结束======\n`) }