| 446 | |
| 447 | //使用能源 |
| 448 | function useEnergy(PropID) { |
| 449 | return new Promise((resolve) => { |
| 450 | var PropNumTask = 0; |
| 451 | let PropCount = 0 |
| 452 | if (PropID) { |
| 453 | for (let i = 0; i < PropID.length; i++) { |
| 454 | let body = { |
| 455 | "source":"game", |
| 456 | "energy_id": PropID[i] |
| 457 | } |
| 458 | const PropUrl = { |
| 459 | // url: JD_API_HOST + '?appid=memberTaskCenter&functionId=energyProp_use&body=%7B%22source%22%3A%22game%22%2C%22energy_id%22%3A%22' + PropID[i] + '%22%7D', |
| 460 | url: `${JD_API_HOST}?appid=memberTaskCenter&functionId=energyProp_use&body=${escape(JSON.stringify(body))}`, |
| 461 | headers: { |
| 462 | Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html', |
| 463 | Cookie: cookie |
| 464 | } |
| 465 | }; |
| 466 | PropCount += 1; |
| 467 | $.get(PropUrl, (error, response, data) => { |
| 468 | try { |
| 469 | if (error) { |
| 470 | console.log("\n天天加速-使用燃料请求失败 ‼️‼️") |
| 471 | console.log(`${JSON.stringify(error)}`) |
| 472 | } else { |
| 473 | if (data) { |
| 474 | const cc = JSON.parse(data); |
| 475 | console.log("\n天天加速-尝试使用第" + PropCount + "个燃料") |
| 476 | if (cc.message === 'success' && cc.success === true) { |
| 477 | PropNumTask += 1 |
| 478 | } |
| 479 | } else { |
| 480 | console.log(`京豆api返回数据为空,请检查自身原因`) |
| 481 | } |
| 482 | } |
| 483 | } catch (eor) { |
| 484 | // $.msg("天天加速-使用燃料" + eor.name + "‼️", JSON.stringify(eor), eor.message) |
| 485 | $.logErr(e, resp) |
| 486 | } finally { |
| 487 | if (PropID.length === PropCount) { |
| 488 | console.log("\n天天加速-已成功使用" + PropNumTask + "个燃料") |
| 489 | resolve(PropNumTask) |
| 490 | } |
| 491 | } |
| 492 | }) |
| 493 | } |
| 494 | } else { |
| 495 | resolve(PropNumTask) |
| 496 | } |
| 497 | }) |
| 498 | } |
| 499 | //虫洞 |
| 500 | function getMemBerList() { |
| 501 | return new Promise((resolve) => { |