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

Function totalBean

jd_try.js:456–500  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

454}
455
456function totalBean() {
457 return new Promise(async resolve => {
458 const options = {
459 "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
460 "headers": {
461 "Accept": "application/json,text/plain, */*",
462 "Content-Type": "application/x-www-form-urlencoded",
463 "Accept-Encoding": "gzip, deflate, br",
464 "Accept-Language": "zh-cn",
465 "Connection": "keep-alive",
466 "Cookie": $.cookie,
467 "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
468 "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")
469 },
470 "timeout": 10000,
471 }
472 $.post(options, (err, resp, data) => {
473 try {
474 if (err) {
475 console.log(`${JSON.stringify(err)}`)
476 console.log(`${$.name} API请求失败,请检查网路重试`)
477 } else {
478 if (data) {
479 data = JSON.parse(data);
480 if (data['retcode'] === 13) {
481 $.isLogin = false; //cookie过期
482 return
483 }
484 if (data['retcode'] === 0) {
485 $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
486 } else {
487 $.nickName = $.UserName
488 }
489 } else {
490 console.log(`京东服务器返回空数据`)
491 }
492 }
493 } catch (e) {
494 $.logErr(e, resp)
495 } finally {
496 resolve();
497 }
498 })
499 })
500}
501
502function jsonParse(str) {
503 if (typeof str == "string") {

Callers 1

jd_try.jsFile · 0.70

Calls 5

isNodeMethod · 0.45
getdataMethod · 0.45
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected