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

Function TotalBean

jd_blueCoin.js:413–456  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

411 })
412}
413function TotalBean() {
414 return new Promise(async resolve => {
415 const options = {
416 "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
417 "headers": {
418 "Accept": "application/json,text/plain, */*",
419 "Content-Type": "application/x-www-form-urlencoded",
420 "Accept-Encoding": "gzip, deflate, br",
421 "Accept-Language": "zh-cn",
422 "Connection": "keep-alive",
423 "Cookie": cookie,
424 "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
425 "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")
426 }
427 }
428 $.post(options, (err, resp, data) => {
429 try {
430 if (err) {
431 console.log(`${JSON.stringify(err)}`)
432 console.log(`${$.name} API请求失败,请检查网路重试`)
433 } else {
434 if (data) {
435 data = JSON.parse(data);
436 if (data['retcode'] === 13) {
437 $.isLogin = false; //cookie过期
438 return
439 }
440 if (data['retcode'] === 0) {
441 $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
442 } else {
443 $.nickName = $.UserName
444 }
445 } else {
446 console.log(`京东服务器返回空数据`)
447 }
448 }
449 } catch (e) {
450 $.logErr(e, resp)
451 } finally {
452 resolve();
453 }
454 })
455 })
456}
457function safeGet(data) {
458 try {
459 if (typeof JSON.parse(data) == "object") {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected