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

Function TotalBean

jd_redPacket.js:1404–1444  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1402
1403
1404function TotalBean() {
1405 return new Promise(async resolve => {
1406 const options = {
1407 url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
1408 headers: {
1409 Host: "me-api.jd.com",
1410 Accept: "*/*",
1411 Connection: "keep-alive",
1412 Cookie: cookie,
1413 "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"),
1414 "Accept-Language": "zh-cn",
1415 "Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
1416 "Accept-Encoding": "gzip, deflate, br"
1417 }
1418 }
1419 $.get(options, (err, resp, data) => {
1420 try {
1421 if (err) {
1422 $.logErr(err)
1423 } else {
1424 if (data) {
1425 data = JSON.parse(data);
1426 if (data['retcode'] === "1001") {
1427 $.isLogin = false; //cookie过期
1428 return;
1429 }
1430 if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
1431 $.nickName = data.data.userInfo.baseInfo.nickname;
1432 }
1433 } else {
1434 $.log('京东服务器返回空数据');
1435 }
1436 }
1437 } catch (e) {
1438 $.logErr(e)
1439 } finally {
1440 resolve();
1441 }
1442 })
1443 })
1444}
1445
1446function jsonParse(str) {
1447 if (typeof str == "string") {

Callers 1

jd_redPacket.jsFile · 0.70

Calls 5

isNodeMethod · 0.45
getdataMethod · 0.45
getMethod · 0.45
logErrMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected