From d4c8e3044444d5baab6684d157c4055d39bb7745 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Thu, 10 Dec 2020 14:34:42 +0800 Subject: [PATCH 1/5] update --- jd_joy.js | 52 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/jd_joy.js b/jd_joy.js index ec392ea2..c6752690 100644 --- a/jd_joy.js +++ b/jd_joy.js @@ -131,12 +131,12 @@ async function joinTwoPeopleRun() { joyRunFlag = process.env.JOY_RUN_FLAG; } if (`${joyRunFlag}` === 'true') { - console.log(`\n===========以下是双人赛跑信息========\n`) + teamLevel = $.isNode() ? (process.env.JOY_TEAM_LEVEL ? process.env.JOY_TEAM_LEVEL : teamLevel) : ($.getdata('JOY_TEAM_LEVEL') ? $.getdata('JOY_TEAM_LEVEL') : teamLevel); + console.log(`\n===========以下是${teamLevel}人赛跑信息========\n`) await getPetRace(); if ($.petRaceResult) { - teamLevel = $.isNode() ? (process.env.JOY_TEAM_LEVEL ? process.env.JOY_TEAM_LEVEL : teamLevel) : ($.getdata('JOY_TEAM_LEVEL') ? $.getdata('JOY_TEAM_LEVEL') : teamLevel); let petRaceResult = $.petRaceResult.data.petRaceResult; - let raceUsers = $.petRaceResult.data.raceUsers; + // let raceUsers = $.petRaceResult.data.raceUsers; console.log(`赛跑状态:${petRaceResult}\n`); if (petRaceResult === 'not_participate') { console.log(`暂未参赛,现在为您参加${teamLevel}人赛跑`); @@ -146,7 +146,8 @@ async function joinTwoPeopleRun() { message += `${teamLevel}人赛跑:成功参加\n`; await getPetRace(); petRaceResult = $.petRaceResult.data.petRaceResult; - raceUsers = $.petRaceResult.data.raceUsers; + await getRankList(); + // raceUsers = $.petRaceResult.data.raceUsers; // console.log(`参赛后的状态:${petRaceResult}`) console.log(`双人赛跑助力请自己手动去邀请好友,脚本不带赛跑助力功能\n`); } @@ -172,25 +173,26 @@ async function joinTwoPeopleRun() { } } if (petRaceResult === 'participate') { - if(raceUsers) { - for (let index =0; index < raceUsers.length; index++) { - if (raceUsers[index].myself) { - console.log(`您当前里程:${raceUsers[index].distance}KM\n`); - message += `您当前里程:${raceUsers[index].distance}km\n`; + await getRankList(); + if($.raceUsers && $.raceUsers.length > 0) { + for (let index = 0; index < $.raceUsers.length; index++) { + if (index === 0) { + console.log(`您当前里程:${$.raceUsers[index].distance}KM\n当前排名:第${$.raceUsers[index].rank}名\n将获得积分:${$.raceUsers[index].coin}\n`); + // message += `您当前里程:${$.raceUsers[index].distance}km\n`; } else { - console.log(`对手当前里程:${raceUsers[index].distance}KM\n`); - message += `对手当前里程:${raceUsers[index].distance}km\n`; + console.log(`对手当前里程:${$.raceUsers[index].distance}KM`); + // message += `对手当前里程:${$.raceUsers[index].distance}km\n`; } } } - console.log('今日已参赛,下面显示应援团信息\n'); + console.log('\n今日已参赛,下面显示应援团信息'); await getBackupInfo(); if ($.getBackupInfoResult.success) { const { currentNickName, totalMembers, totalDistance, backupList } = $.getBackupInfoResult.data; console.log(`${currentNickName}的应援团信息如下\n团员:${totalMembers}个\n团员助力的里程数:${totalDistance}\n`); if (backupList && backupList.length > 0) { for (let item of backupList) { - console.log(`${item.nickName}为您助力${item.distance}km\n`); + console.log(`${item.nickName}为您助力${item.distance}km`); } } else { console.log(`暂无好友为您助力赛跑,如需助力,请手动去邀请好友助力\n`); @@ -610,6 +612,30 @@ function getPetRace() { }) }) } +//查询赛跑排行榜 +function getRankList() { + return new Promise(resolve => { + const url = `${JD_API_HOST}/combat/getRankList`; + $.raceUsers = []; + $.get(taskUrl(url, `jdjoy.jd.com`, 'h5'), (err, resp, data) => { + try { + if (err) { + console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️') + } else { + // console.log('查询赛跑信息API',(data)) + data = JSON.parse(data); + if (data.success) { + $.raceUsers = data.datas; + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }) + }) +} //参加赛跑API function runMatch(teamLevel, timeout = 5000) { if (teamLevel === 10 || teamLevel === 50) timeout = 60000; From 38337a54c3b64e1510b8abdda44bc8bed857e2fc Mon Sep 17 00:00:00 2001 From: DoveBoy <393366046@qq.com> Date: Fri, 11 Dec 2020 08:49:37 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BA=91=E5=87=BD=E6=95=B0=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E6=96=B0=E5=A2=9E=E4=BA=AC=E4=B8=9C=E7=9B=B4=E6=92=AD?= =?UTF-8?q?18=E8=B1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 云函数同步新增京东直播18豆 --- serverless.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/serverless.yml b/serverless.yml index b7763dba..e4213ab2 100644 --- a/serverless.yml +++ b/serverless.yml @@ -40,12 +40,12 @@ inputs: cronExpression: "0 3 */1 * * * *" enable: true argument: jd_joy_feedPets&jd_joy&jd_moneyTree&jd_plantBean&jd_dreamFactory&jd_jdfactory - - timer: # 宠汪汪积分兑换奖品# 宠汪汪偷好友积分与狗# 点点券 + - timer: # 宠汪汪积分兑换奖品# 宠汪汪偷好友积分与狗# 点点券# 京东直播18豆 parameters: - name: jd_joy_reward_jd_joy_steal_jd_necklace + name: joy_reward_joy_steal_necklace_live cronExpression: "0 0 0-16/8,20 * * * *" enable: true - argument: jd_joy_reward&jd_joy_steal&jd_necklace + argument: jd_joy_reward&jd_joy_steal&jd_necklace&jd_live - timer: # 京东全民开红包 # 进店领豆 # 取关京东店铺商品# 京东抽奖机# 东东小窝# 秒杀红包雨# 健康抽奖机 parameters: name: redPacket_shop_unsubscribe_lotteryMachine_small_home_ms_redrain_health From e91ad412e1d7f73fdbd786f4829aa6f04e1e3ad9 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 11 Dec 2020 09:49:59 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=9C=88x,loon=E7=AD=89=E8=AE=A2=E9=98=85,?= =?UTF-8?q?docker=E6=B7=BB=E5=8A=A0=E4=BA=AC=E4=B8=9C=E7=9B=B4=E6=92=AD(jd?= =?UTF-8?q?=5Flive.js)=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Loon/lxk0301_LoonTask.conf | 7 +++++-- QuantumultX/lxk0301_gallery.json | 1 + docker/crontab_list.sh | 2 ++ docker/crontab_list_ts.sh | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Loon/lxk0301_LoonTask.conf b/Loon/lxk0301_LoonTask.conf index 24eee260..27616530 100644 --- a/Loon/lxk0301_LoonTask.conf +++ b/Loon/lxk0301_LoonTask.conf @@ -122,7 +122,10 @@ cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scrip cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ms_redrain.js, tag=秒杀红包雨 # 金榜年终奖 -cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_split.js,tag=年终奖 +cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_split.js, tag=年终奖 # PUBG -cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pubg.js,tag=PUBG +cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pubg.js, tag=PUBG + +# 京东直播 +cron "10-20/5 12 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live.js, tag=京东直播 diff --git a/QuantumultX/lxk0301_gallery.json b/QuantumultX/lxk0301_gallery.json index 1db5c159..e5c8feca 100644 --- a/QuantumultX/lxk0301_gallery.json +++ b/QuantumultX/lxk0301_gallery.json @@ -33,6 +33,7 @@ "0 0,9,11,13,15,17,19,20,21,23 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live_redrain.js, tag=直播红包雨, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png", "10 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_apple_live.js, tag=苹果抽奖机, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png", "10 1 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pubg.js, tag=PUBG, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png", + "10-20/5 12 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live.js, tag=京东直播, img-url= https://raw.githubusercontent.com/58xinian/icon/master/jd_live_redrain.png", "15 17 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, tag=小米运动, img-url=https://raw.githubusercontent.com/58xinian/icon/master/xmyd.png" ] } diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh index edde6fd1..a1a71cde 100644 --- a/docker/crontab_list.sh +++ b/docker/crontab_list.sh @@ -84,3 +84,5 @@ 33 2 * * * node /scripts/jd_car.js >> /scripts/logs/jd_car.log 2>&1 # 领京豆额外奖励(每日可获得3京豆) 33 4 * * * node /scripts/jd_bean_home.js >> /scripts/logs/jd_bean_home.log 2>&1 +# 京东直播(每日18豆) +10-20/5 11 * * * node /scripts/jd_live.js |ts >> /scripts/logs/jd_live.log 2>&1 \ No newline at end of file diff --git a/docker/crontab_list_ts.sh b/docker/crontab_list_ts.sh index 90039c3c..4271b171 100644 --- a/docker/crontab_list_ts.sh +++ b/docker/crontab_list_ts.sh @@ -83,4 +83,6 @@ # 京东汽车(签到满500赛点可兑换500京豆) 33 2 * * * node /scripts/jd_car.js |ts >> /scripts/logs/jd_car.log 2>&1 # 领京豆额外奖励(每日可获得3京豆) -33 4 * * * node /scripts/jd_bean_home.js |ts >> /scripts/logs/jd_bean_home.log 2>&1 \ No newline at end of file +33 4 * * * node /scripts/jd_bean_home.js |ts >> /scripts/logs/jd_bean_home.log 2>&1 +# 京东直播(每日18豆) +10-20/5 11 * * * node /scripts/jd_live.js |ts >> /scripts/logs/jd_live.log 2>&1 \ No newline at end of file From b5df16ab4e92fa693877b839ca1b8b3ea3162a88 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 11 Dec 2020 10:17:40 +0800 Subject: [PATCH 4/5] fix --- docker/crontab_list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh index a1a71cde..4fd063d4 100644 --- a/docker/crontab_list.sh +++ b/docker/crontab_list.sh @@ -85,4 +85,4 @@ # 领京豆额外奖励(每日可获得3京豆) 33 4 * * * node /scripts/jd_bean_home.js >> /scripts/logs/jd_bean_home.log 2>&1 # 京东直播(每日18豆) -10-20/5 11 * * * node /scripts/jd_live.js |ts >> /scripts/logs/jd_live.log 2>&1 \ No newline at end of file +10-20/5 11 * * * node /scripts/jd_live.js >> /scripts/logs/jd_live.log 2>&1 \ No newline at end of file From 78eb14f8b88a4d1f29230b129c4c336e53a1b649 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 11 Dec 2020 12:02:42 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=B8=9C=E4=B8=9C=E5=B0=8F=E7=AA=9D,?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A3=85=E9=A5=B0=E9=A2=86=E4=BA=AC=E8=B1=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_small_home.js | 138 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 110 insertions(+), 28 deletions(-) diff --git a/jd_small_home.js b/jd_small_home.js index d310a1be..38321aab 100644 --- a/jd_small_home.js +++ b/jd_small_home.js @@ -2,7 +2,7 @@ * @Author: lxk0301 https://github.com/lxk0301 * @Date: 2020-11-12 11:42:12 * @Last Modified by: lxk0301 - * @Last Modified time: 2020-11-23 12:27:20 + * @Last Modified time: 2020-12-11 12:27:20 */ /* 东东小窝 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js @@ -103,6 +103,7 @@ async function smallHome() { await lottery(); await doAllTask(); await queryByUserId(); + await queryFurnituresCenterList(); await showMsg(); } function showMsg() { @@ -118,33 +119,7 @@ async function lottery() { console.log(`免费抽奖机会今日已使用\n`) } } -//获取详情 -function queryByUserId() { - return new Promise(resolve => { - $.get(taskUrl(`ssjj-wo-home-info/queryByUserId/2`), (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.head.code === 200) { - if (data.body) { - message += `【小窝名】${data.body.name}\n`; - message += `【当前WO币】${data.body.woB}\n`; - } - } - } - } - } catch (e) { - $.logErr(e, resp) - } finally { - resolve(data); - } - }) - }) -} + async function doChannelsListTask(taskId, taskType) { await queryChannelsList(taskId); for (let item of $.queryChannelsList) { @@ -270,6 +245,94 @@ async function doAllTask() { } } } +function queryFurnituresCenterList() { + return new Promise(resolve => { + $.get(taskUrl(`ssjj-furnitures-center/queryFurnituresCenterList`), async (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.head.code === 200) { + let { buy, list } = data.body; + $.canBuyList = []; + list.map((item, index) => { + if (buy.some((buyItem) => buyItem === item.id)) return + $.canBuyList.push(item); + }) + $.canBuyList.sort(sortByjdBeanNum); + for (let canBuyItem of $.canBuyList) { + if (canBuyItem.needWoB <= $.woB) { + await furnituresCenterPurchase(canBuyItem.id, canBuyItem.jdBeanNum); + break + } + } + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(data); + } + }) + }) +} +//装饰领京豆 +function furnituresCenterPurchase(id, jdBeanNum) { + return new Promise(resolve => { + $.post(taskPostUrl(`ssjj-furnitures-center/furnituresCenterPurchase/${id}`), (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.head.code === 200) { + message += `【装饰领京豆】${jdBeanNum}兑换成功\n`; + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(data); + } + }) + }) +} + +//获取详情 +function queryByUserId() { + return new Promise(resolve => { + $.get(taskUrl(`ssjj-wo-home-info/queryByUserId/2`), (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.head.code === 200) { + if (data.body) { + message += `【小窝名】${data.body.name}\n`; + $.woB = data.body.woB; + message += `【当前WO币】${data.body.woB}\n`; + } + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(data); + } + }) + }) +} //获取需要关注的频道列表 function queryChannelsList(taskId) { return new Promise(resolve => { @@ -747,6 +810,25 @@ function taskUrl(url, body = {}) { } } } +function taskPostUrl(url) { + return { + url: `${JD_API_HOST}/${url}`, + headers: { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "zh-CN,zh;q=0.9", + "Connection": "keep-alive", + "content-type": "application/json", + "Host": "lkyl.dianpusoft.cn", + "Referer": "https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html", + "token": $.token, + "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") + } + } +} +function sortByjdBeanNum(a, b) { + return b['jdBeanNum'] - a['jdBeanNum']; +} function TotalBean() { return new Promise(async resolve => { const options = {