MCPcopy Index your code
hub / github.com/NobyDa/Script / TotalBean

Function TotalBean

JD-DailyBonus/JD_DailyBonus.js:1456–1488  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1454}
1455
1456function TotalBean() {
1457 merge.TotalBean = {};
1458 return new Promise(resolve => {
1459 if (disable("Qbear")) return resolve()
1460 $nobyda.get({
1461 url: 'https://me-api.jd.com/user_new/info/GetJDUserInfoUnion',
1462 headers: {
1463 Cookie: KEY
1464 }
1465 }, (error, response, data) => {
1466 try {
1467 if (error) throw new Error(error);
1468 const Details = LogDetails ? "response:\n" + data : '';
1469 const cc = JSON.parse(data)
1470 if (cc.msg == 'success' && cc.retcode == 0) {
1471 merge.TotalBean.nickname = cc.data.userInfo.baseInfo.nickname || ""
1472 merge.TotalBean.Qbear = cc.data.assetInfo.beanNum || 0
1473 $nobyda.headUrl = cc.data.userInfo.baseInfo.headImageUrl || ""
1474 console.log(`\n京东-总京豆查询成功 ${Details}`)
1475 } else {
1476 const name = decodeURIComponent(KEY.split(/pt_pin=(.+?);/)[1] || '');
1477 merge.TotalBean.nickname = cc.retcode == 1001 ? `${name} (CK失效‼️)` : "";
1478 console.log(`\n京东-总京豆查询失败 ${Details}`)
1479 }
1480 } catch (eor) {
1481 $nobyda.AnError("账户京豆-查询", "TotalBean", eor, response, data)
1482 } finally {
1483 resolve()
1484 }
1485 })
1486 if (out) setTimeout(resolve, out)
1487 });
1488}
1489
1490function TotalCash() {
1491 merge.TotalCash = {};

Callers 1

allFunction · 0.85

Calls 3

disableFunction · 0.85
getMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected