()
| 1423 | }) |
| 1424 | } |
| 1425 | function TotalBean() { |
| 1426 | return new Promise(async resolve => { |
| 1427 | const options = { |
| 1428 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, |
| 1429 | "headers": { |
| 1430 | "Accept": "application/json,text/plain, */*", |
| 1431 | "Content-Type": "application/x-www-form-urlencoded", |
| 1432 | "Accept-Encoding": "gzip, deflate, br", |
| 1433 | "Accept-Language": "zh-cn", |
| 1434 | "Connection": "keep-alive", |
| 1435 | "Cookie": cookie, |
| 1436 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2", |
| 1437 | "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1" |
| 1438 | } |
| 1439 | } |
| 1440 | $.post(options, (err, resp, data) => { |
| 1441 | try { |
| 1442 | if (err) { |
| 1443 | console.log(`${JSON.stringify(err)}`) |
| 1444 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 1445 | } else { |
| 1446 | if (data) { |
| 1447 | data = JSON.parse(data); |
| 1448 | if (data['retcode'] === 13) { |
| 1449 | $.isLogin = false; //cookie过期 |
| 1450 | return |
| 1451 | } |
| 1452 | if (data['retcode'] === 0) { |
| 1453 | $.nickName = (data['base'] && data['base'].nickname) || $.UserName; |
| 1454 | } else { |
| 1455 | $.nickName = $.UserName |
| 1456 | } |
| 1457 | } else { |
| 1458 | console.log(`京东服务器返回空数据`) |
| 1459 | } |
| 1460 | } |
| 1461 | } catch (e) { |
| 1462 | $.logErr(e, resp) |
| 1463 | } finally { |
| 1464 | resolve(); |
| 1465 | } |
| 1466 | }) |
| 1467 | }) |
| 1468 | } |
| 1469 | function safeGet(data) { |
| 1470 | try { |
| 1471 | if (typeof JSON.parse(data) == "object") { |
no test coverage detected