MCPcopy Create free account
hub / github.com/Semporia/Scripts / getJdCash

Function getJdCash

jd_get_share_code.js:610–647  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

608}
609//领现金
610function getJdCash() {
611 function taskUrl(functionId, body = {}) {
612 return {
613 url: `https://api.m.jd.com/client.action?functionId=${functionId}&body=${escape(JSON.stringify(body))}&appid=CashRewardMiniH5Env&appid=9.1.0`,
614 headers: {
615 'Cookie': cookie,
616 'Host': 'api.m.jd.com',
617 'Connection': 'keep-alive',
618 'Content-Type': 'application/json',
619 'Referer': 'http://wq.jd.com/wxapp/pages/hd-interaction/index/index',
620 '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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
621 'Accept-Language': 'zh-cn',
622 'Accept-Encoding': 'gzip, deflate, br',
623 }
624 }
625 }
626 return new Promise((resolve) => {
627 $.get(taskUrl("cash_mob_home",), async (err, resp, data) => {
628 try {
629 if (err) {
630 console.log(`${JSON.stringify(err)}`)
631 console.log(`${$.name} API请求失败,请检查网路重试`)
632 } else {
633 if (safeGet(data)) {
634 data = JSON.parse(data);
635 if(data.code===0 && data.data.result){
636 console.log(`【京东账号${$.index}(${$.UserName})签到领现金】${data.data.result.inviteCode}`);
637 }
638 }
639 }
640 } catch (e) {
641 $.logErr(e, resp)
642 } finally {
643 resolve(data);
644 }
645 })
646 })
647}
648async function getShareCode() {
649 console.log(`======账号${$.index}开始======`)
650 await getJDFruit()

Callers 1

getShareCodeFunction · 0.85

Calls 5

taskUrlFunction · 0.70
safeGetFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected