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

Function getJdZZ

jd_get_share_code.js:300–344  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

298 })
299}
300async function getJdZZ() {
301 const JDZZ_API_HOST = "https://api.m.jd.com/client.action";
302 function getTaskList() {
303 return new Promise(resolve => {
304 $.get(taskZZUrl("interactTaskIndex"), async (err, resp, data) => {
305 try {
306 if (err) {
307 console.log(`${JSON.stringify(err)}`)
308 console.log(`${$.name} API请求失败,请检查网路重试`)
309 } else {
310 if (safeGet(data)) {
311 data = JSON.parse(data);
312 $.taskList = data.data.taskDetailResList;
313 if ($.taskList.filter(item => !!item && item['taskId']=== 3) && $.taskList.filter(item => !!item && item['taskId']=== 3).length) {
314 console.log(`【京东账号${$.index}(${$.UserName})的京东赚赚好友互助码】${$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId']}`);
315 }
316 }
317 }
318 } catch (e) {
319 $.logErr(e, resp)
320 } finally {
321 resolve(data);
322 }
323 })
324 })
325 }
326
327 function taskZZUrl(functionId, body = {}) {
328 return {
329 url: `${JDZZ_API_HOST}?functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=9.1.0`,
330 headers: {
331 'Cookie': cookie,
332 'Host': 'api.m.jd.com',
333 'Connection': 'keep-alive',
334 'Content-Type': 'application/json',
335 'Referer': 'http://wq.jd.com/wxapp/pages/hd-interaction/index/index',
336 '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"),
337 'Accept-Language': 'zh-cn',
338 'Accept-Encoding': 'gzip, deflate, br',
339 }
340 }
341 }
342
343 await getTaskList()
344}
345async function getPlantBean() {
346 const JDplant_API_HOST = "https://api.m.jd.com/client.action";
347

Callers 1

getShareCodeFunction · 0.85

Calls 1

getTaskListFunction · 0.70

Tested by

no test coverage detected