From b0c7d560fcc44e3e65021369804750f44db02983 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Mon, 30 Nov 2020 20:59:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=94=B6=E5=9C=B0=E4=B8=8B?= =?UTF-8?q?=E9=9B=B6=E4=BB=B6=E8=8E=B7=E5=BE=97=E7=94=B5=E5=8A=9B=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E6=9A=82=E6=97=B6=E5=8E=BB=E6=8E=89=E5=81=B7?= =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E7=94=B5=E5=8A=9B=E5=8A=9F=E8=83=BD(?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=8F=8C=E5=80=8D=E7=94=B5=E5=8A=9B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_dreamFactory.js | 58 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js index db3801ae..e2b3bae2 100644 --- a/jd_dreamFactory.js +++ b/jd_dreamFactory.js @@ -57,6 +57,8 @@ if ($.isNode()) { $.nickName = ''; message = ''; $.ele = 0; + $.pickEle = 0; + $.pickFriendEle = 0 await TotalBean(); console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`); if (!$.isLogin) { @@ -90,7 +92,8 @@ async function jdDreamFactory() { await taskList(); await investElectric(); await hireAward(); - await stealFriend(); + await PickUp(); + // await stealFriend(); await showMsg(); } @@ -469,10 +472,12 @@ function userInfo() { await GetCommodityDetails();//获取已选购的商品信息 await DrawProductionStagePrize();//领取红包 console.log(`当前电力:${data.user.electric}`) + console.log(`当前等级:${data.user.currentLevel}`) console.log(`分享码: ${data.user.encryptPin}`); console.log(`生产进度:${((production.investedElectric / production.needElectric) * 100).toFixed(2)}%`); message += `【京东账号${$.index}】${$.nickName}\n` message += `【生产商品】${$.productName}\n`; + message += `【当前等级】${data.user.currentLevel}\n`; message += `【生产进度】${((production.investedElectric / production.needElectric) * 100).toFixed(2)}%\n`; if (production.investedElectric >= production.needElectric) { $.msg($.name, ``, `【京东账号${$.index}】${$.nickName}\n【生产商品】${$.productName}\n已生产完,请速去兑换`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://wqsd.jd.com/pingou/dream_factory/index.html%22%20%7D'}) @@ -557,6 +562,50 @@ function DrawProductionStagePrize() { }) }) } +async function PickUp(encryptPin = $.encryptPin, help = false) { + for (let i = 0; i < new Array(5).fill('').length; i++) { + await $.wait(1000); + await PickUpComponent(i + 1, encryptPin, help); + } +} +//收取地下随机零件电力API +//usermaterial/GetUserComponent +function PickUpComponent(index, encryptPin, help) { + return new Promise(resolve => { + $.get(taskurl('usermaterial/PickUpComponent', `placeId=${index}&pin=${encryptPin}`), (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data['ret'] === 0) { + data = data['data']; + if (help) { + console.log(`收取好友零件成功:获得${data['increaseElectric']}电力\n`); + $.pickFriendEle += data['increaseElectric']; + } else { + console.log(`收取自家零件成功:获得${data['increaseElectric']}电力\n`); + $.pickEle += data['increaseElectric']; + } + } else { + if (help) { + console.log(`收好友零件失败:${JSON.stringify(data)}`) + } else { + console.log(`收零件失败:${JSON.stringify(data)}`) + } + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} //偷好友的电力 function stealFriend() { return new Promise(async resolve => { @@ -573,7 +622,8 @@ function stealFriend() { for (let i = 0; i < data.list.length; i++) { let pin = data.list[i]['encryptPin']; await getFactoryIdByPin(pin); - if ($.stealFactoryId) await collectElectricity($.stealFactoryId,true, data.list[i]['key']) + if ($.stealFactoryId) await collectElectricity($.stealFactoryId,true, data.list[i]['key']); + await PickUp(pin, true) } } else { console.log(`异常:${JSON.stringify(data)}`) @@ -709,10 +759,10 @@ async function showMsg() { if (ctrTemp) { $.msg($.name, '', message); if ($.isNode()) { - await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `${message}`); + await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `${message}\n【收取零件】获得${$.pickEle}电力`); } } else { - $.log(`\n${message}\n`); + $.log(`\n${message}【收取自己零件】获得${$.pickEle}电力\n【收取好友零件】获得${$.pickFriendEle}电力`); } resolve() })