From 1b4581aae94b664957852c53e2289679a9057cb1 Mon Sep 17 00:00:00 2001 From: DoveBoy <393366046@qq.com> Date: Mon, 28 Dec 2020 20:09:48 +0800 Subject: [PATCH 01/52] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=91=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=95=99=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新云函数教程 --- iCloud.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/iCloud.md b/iCloud.md index 4066d16d..9eb86134 100644 --- a/iCloud.md +++ b/iCloud.md @@ -149,6 +149,60 @@ let CookieJDs = [ 目前repo中按照每个脚本一个定时器的方式设置到云函数中,大约需要触发器10多个,由于云函数触发器限制最多10个,需要对触发器进行整合,整合后触发器保持在10个以内,以下设置仅供参考
-![iCloud5](./icon/iCloud5.png) +| **JavaScript** | **脚本名称** | **活动时间** | **原Repository UTC时间** | **适用于云函数的北京时间** | **serverless.yml** | +| :----------------------: | :----------------------: | :----------: | :-----------------------: | :-------------------------: | :----------------: | +| `jd_bean_change` | 京豆变动通知 | 长期 | 0 2 * * * | 0 1 */1 * * | 30 7 * * * | +| `jd_bean_home` | 领京豆额外奖励 | 长期 | / | 0 1 */1 * * | 30 7 * * * | +| `jd_bean_sign` | 京豆签到 | 长期 | 0 16 * * * | 0 0 */1 * * | 0 0 * * * | +| `jd_blueCoin` | 京小超兑换奖品 | 长期 | 0 16 * * * | 0 1 */1 * * | 0 0 * * * | +| `jd_car` | 京东汽车 | 长期 | / | 0 0 */1 * * | 0 0 * * * | +| `jd_club_lottery` | 摇京豆 | 长期 | 0 16 * * * | 0 0 */1 * * | 0 0 * * * | +| `jd_crazy_joy` | 疯狂的joy | 长期 | / | / | 30 7 * * * | +| `jd_crazy_joy_coin` | 疯狂的joy挂机 | 长期 | / | / | / | +| `jd_daily_egg` | 京东金融-天天提额 | 长期 | 10 */3 * * * | 0-12/3 */3 * * * | 8 */3 * * * | +| `jd_dreamFactory` | 京喜工厂 | 长期 | / | */30 * * * * | 3 */1 * * * | +| `jd_ds` | 京东代属(校园用户) | 长期 | / | / | / | +| `jd_fruit` | 东东农场 | 长期 | 20 23,4,10 * * * | 0,5,10 8,9,12,18,23,0 * * * | 5 6-18/6 * * * | +| `jd_health` | 健康抽奖机 | 短期 | / | 0 0 */1 * * | 10 0 * * * | +| `jd_jdfactory` | 东东工厂 | 长期 | / | */30 * * * * | 3 */1 * * * | +| `jd_jdh` | 京东健康APP | 短期 | / | / | 30 7 * * * | +| `jd_jdzz` | 京东赚赚 | 长期 | / | / | 3 1 * * * | +| `jd_joy` | 宠汪汪 | 长期 | 0 0,1,4,10,15,16 * * * | 0,5,10 8,9,12,18,23,0 * * * | 3 */1 * * * | +| `jd_joy_feedPets` | 宠汪汪单独喂食 | 长期 | */20 */1 * * * | 0-12/3 */3 * * * | 3 */1 * * * | +| `jd_joy_help` | 宠汪汪强制为别人助力 | 长期 | / | / | / | +| `jd_joy_reward` | 宠汪汪兑换奖品 | 长期 | 0 0,4,8,16 * * * | 0 8,12,16,0 */1 * * | 0 0-16/8,20 * * * | +| `jd_joy_run` | 宠汪汪邀请助力与赛跑助力 | 长期 | / | / | / | +| `jd_joy_steal` | 宠汪汪偷好友狗粮与积分 | 长期 | 0 16,22 * * * | 0 0,6,20 */1 * * | 0 0-16/8,20 * * * | +| `jd_kd` | 京东快递 | 长期 | / | 0 1 */1 * * | 3 1 * * * | +| `jd_live` | 京东直播18豆 | 长期 | / | / | 0 0-16/8,20 * * * | +| `jd_live_redrain` | 超级直播间红包雨 | 短期 | / | 0 0,20,9-23/2 * * MON-FRI | / | +| `jd_lotteryMachine` | 京东抽奖机 | 长期 | 11 17 * * * | 0 0 */1 * * | 10 0 * * * | +| `jd_moneyTree` | 摇钱树 | 长期 | 40 */3 * * * | 0-12/3 */3 * * * | 3 */1 * * * | +| `jd_ms_redrain` | 秒杀红包雨 | 短期 | / | 0 1 */1 * * | 10 0 * * * | +| `jd_necklace` | 点点券 | 长期 | / | 0 0,6,20 */1 * * | 0 0-16/8,20 * * * | +| `jd_pet` | 东东萌宠 | 长期 | 35 23,4,10 * * * | 0,5,10 8,9,12,18,23,0 * * * | 5 6-18/6 * * * | +| `jd_petTreasureBox` | 宠汪汪聚宝盆 | 长期 | / | / | / | +| `jd_pigPet` | 京东金融-养猪猪 | 长期 | / | 0-12/3 */3 * * * | 3 1 * * * | +| `jd_plantBean` | 种豆得豆 | 长期 | 0 23,0-14/1 * * * | 0-12/3 */3 * * * | 3 */1 * * * | +| `jd_rankingList` | 京东排行榜 | 长期 | 11 18 * * * | 0 0 */1 * * | 30 7 * * * | +| `jd_redPacket` | 全民开红包 | 长期 | 0 17 * * * | 0 1 */1 * * | 10 0 * * * | +| `jd_shop` | 进店领豆 | 长期 | 0 16 * * * | 0 0 */1 * * | 10 0 * * * | +| `jd_small_home` | 东东小窝 | 长期 | / | 0 0,6,20 */1 * * | 10 0 * * * | +| `jd_speed` | 天天加速 | 长期 | 33 */3 * * * | 0-12/3 */3 * * * | 8 */3 * * * | +| `jd_superMarket` | 东东超市 | 长期 | 15 * * * * | */30 * * * * | 15 * * * * | +| `jd_syj` | 十元街 | 长期 | / | 0 1 */1 * * | 3 1 * * * | +| `jd_unbind` | 注销京东会员卡 | 长期 | / | / | 10 0 * * * | +| `jd_unsubscribe` | 取关京东店铺和商品 | 长期 | 45 15 * * * | 0 1 */1 * * | 10 0 * * * | +| `jd_watch` | 发现-看一看 | 长期 | / | / | 3 1 * * * | +| `jr_sign` | 金融打卡年终奖 | 短期 | / | / | 3 1 * * * | +| `jd_818` | 京东手机狂欢城 | 短期 | 0 1,4,7,10,12,16,22 * * * | 0 9,12,15,16,20,0,6 */1 * * | / | +| `jd_apple_live` | 苹果抽奖机 | 短期 | / | / | / | +| `jd_collectProduceScore` | 双十一活动领金币 | 短期 | 30 * * * * | */30 * * * * | / | +| `jd_digital_floor` | 数码加购京豆 | 短期 | / | / | / | +| `jd_jxstory` | 京喜故事 | 短期 | / | / | / | +| `jd_mohe` | 热8超级魔盒 | 短期 | / | / | / | +| `jd_pubg` | PUBG | 短期 | / | / | / | +| `jd_split` | 金榜年终奖 | 短期 | / | / | / | +| `jd_xtg` | 双十一星推官 | 短期 | 0 16 * * * | 0 0 */1 * * | / | 点击提交,所有流程就结束了。 From 240271ab86a89dedb87e074e5bc0386eed34bbf7 Mon Sep 17 00:00:00 2001 From: sxx1314 <8444252+sxx1314@users.noreply.github.com> Date: Thu, 31 Dec 2020 07:45:24 +0800 Subject: [PATCH 02/52] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=9B=BE=E6=96=87?= =?UTF-8?q?=E6=B6=88=E6=81=AF=EF=BC=88=E6=96=87=E7=AB=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 改成了图文消息模式,原本的卡片信息只能显示512字节,并且看不了详情。 - 图文消息,可以设置图片和文章,并且描述也一样是512字节限制。但是可以点进去看文章详情。 - thumb_media_id 需要自己上传企业微信素材库之后才可以查询,必须设置。https://work.weixin.qq.com/api/doc/90000/90135/90253 - 文章内容暂时用的 ${desp} ,测试用marked.js转换之后也不会换行,我也懒得自己写方法希望来个大神补上。 --- sendNotify.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sendNotify.js b/sendNotify.js index eadb860b..262e5e97 100644 --- a/sendNotify.js +++ b/sendNotify.js @@ -49,7 +49,7 @@ let DD_BOT_SECRET = ''; let QYWX_KEY = ''; // =======================================企业微信应用消息通知设置区域=========================================== -//此处填你企业微信应用消息的 值(详见文档 https://work.weixin.qq.com/api/doc/90000/90135/90236),依次填上corpid的值,corpsecret的值,touser的值,agentid的值,注意用,号隔开,例如:wwcff56746d9adwers,B-791548lnzXBE6_BWfxdf3kSTMJr9vFEPKAbh6WERQ,mingcheng,1000001 +//此处填你企业微信应用消息的 值(详见文档 https://work.weixin.qq.com/api/doc/90000/90135/90236),依次填上corpid的值,corpsecret的值,touser的值,agentid的值,素材库图片id(见https://work.weixin.qq.com/api/doc/90000/90135/90253) 注意用,号隔开,例如:wwcff56746d9adwers,B-791548lnzXBE6_BWfxdf3kSTMJr9vFEPKAbh6WERQ,mingcheng,1000001,2COXgjH2UIfERF2zxrtUOKgQ9XklUqMdGSWLBoW_lSDAdafat //注:此处设置github action用户填写到Settings-Secrets里面(Name输入QYWX_AM) let QYWX_AM = ''; @@ -438,12 +438,18 @@ function qywxamNotify(text, desp) { json: { touser:`${QYWX_AM_AY[2]}`, agentid:`${QYWX_AM_AY[3]}`, - msgtype: 'textcard', - textcard: { + msgtype: 'mpnews', + mpnews: { + articles: [ + { title: `${text}`, - description: `${desp}`, - url: '127.0.0.1', - btntxt: '更多' + thumb_media_id: `${QYWX_AM_AY[4]}`, + author : `智能助手` , + content_source_url: ``, + content : `${desp}`, //暂时直接设置成了desp + digest: `${desp}` + } + ] }, safe:'0', }, From c2da5ac479529269feca9755856ef93170eedad3 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Thu, 31 Dec 2020 10:53:46 +0800 Subject: [PATCH 03/52] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_bean_home.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/jd_bean_home.js b/jd_bean_home.js index 7a84357b..ef5932ef 100644 --- a/jd_bean_home.js +++ b/jd_bean_home.js @@ -112,11 +112,15 @@ const JD_API_HOST = 'https://api.m.jd.com/'; async function jdBeanHome() { $.doneState = false - for (let i = 0; i < 3; ++i) { + // for (let i = 0; i < 3; ++i) { + // await doTask2() + // await $.wait(1000) + // if ($.doneState) break + // } + do { await doTask2() await $.wait(1000) - if ($.doneState) break - } + } while (!$.doneState) await $.wait(1000) await award("feeds") await $.wait(1000) @@ -142,10 +146,14 @@ function doTask2() { } else { if (safeGet(data)) { data = JSON.parse(data); - if(data.code === '0' && data.data){ + if (data.code === '0' && data.data){ console.log(`任务完成进度:${data.data.taskProgress} / ${data.data.taskThreshold}`) - if(data.data.taskProgress===data.data.taskThreshold) + if(data.data.taskProgress === data.data.taskThreshold) $.doneState = true + } else if (data.code === '0' && data.errorCode === 'HT201') { + $.doneState = true + } else { + console.log(`做任务异常:${JSON.stringify(data)}`) } } } From 6023537258b656ab6a4bba94f5bdf2fe4785227b Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Thu, 31 Dec 2020 12:35:59 +0800 Subject: [PATCH 04/52] fix --- jd_bean_home.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jd_bean_home.js b/jd_bean_home.js index ef5932ef..dc5c8858 100644 --- a/jd_bean_home.js +++ b/jd_bean_home.js @@ -153,6 +153,7 @@ function doTask2() { } else if (data.code === '0' && data.errorCode === 'HT201') { $.doneState = true } else { + $.doneState = true console.log(`做任务异常:${JSON.stringify(data)}`) } } From 8dbd0de4d8a0f330d4b073d352d611de7253a070 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Thu, 31 Dec 2020 14:43:32 +0800 Subject: [PATCH 05/52] =?UTF-8?q?=E5=A2=9E=E5=A4=A7=E5=BB=B6=E8=BF=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_bean_home.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jd_bean_home.js b/jd_bean_home.js index dc5c8858..666ad746 100644 --- a/jd_bean_home.js +++ b/jd_bean_home.js @@ -119,7 +119,7 @@ async function jdBeanHome() { // } do { await doTask2() - await $.wait(1000) + await $.wait(3000) } while (!$.doneState) await $.wait(1000) await award("feeds") @@ -153,6 +153,7 @@ function doTask2() { } else if (data.code === '0' && data.errorCode === 'HT201') { $.doneState = true } else { + //HT304风控用户 $.doneState = true console.log(`做任务异常:${JSON.stringify(data)}`) } From c48bf23b2802a32e67706eceb2f4d80f84ef9734 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Thu, 31 Dec 2020 16:43:32 +0800 Subject: [PATCH 06/52] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E6=B1=BD=E8=BD=A6=E8=84=9A=E6=9C=AC=E7=9A=84=E6=89=A7=E8=A1=8C?= =?UTF-8?q?cron?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Loon/lxk0301_LoonTask.conf | 2 +- QuantumultX/lxk0301_gallery.json | 2 +- Surge/lxk0301_Task.sgmodule.sgmodule | 2 +- docker/crontab_list.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Loon/lxk0301_LoonTask.conf b/Loon/lxk0301_LoonTask.conf index 8f236711..181904f8 100644 --- a/Loon/lxk0301_LoonTask.conf +++ b/Loon/lxk0301_LoonTask.conf @@ -97,7 +97,7 @@ cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scrip cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_kd.js, tag=京东快递签到 # 京东汽车 -cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_car.js, tag=京东汽车 +cron "0 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_car.js, tag=京东汽车 # 领京豆额外奖励 cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_home.js, tag=领京豆额外奖励 diff --git a/QuantumultX/lxk0301_gallery.json b/QuantumultX/lxk0301_gallery.json index 162513d2..a3709536 100644 --- a/QuantumultX/lxk0301_gallery.json +++ b/QuantumultX/lxk0301_gallery.json @@ -26,7 +26,7 @@ "0 7 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_syj.js, tag=十元街, img-url=https://github.com/58xinian/icon/raw/master/jd_syj.png", "15 7 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ms_redrain.js, tag=秒杀红包雨, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png", "10 6 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_home.js, tag=领京豆额外奖励, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_bean_home.png", - "20 7 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_car.js, tag=京东汽车, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_car.png", + "0 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_car.js, tag=京东汽车, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_car.png", "10 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_kd.js, tag=京东快递签到, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_kd.png", "30 7 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ds.js, tag=京东代属, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_ds.png", "30 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_health.js, tag=健康抽奖机, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png", diff --git a/Surge/lxk0301_Task.sgmodule.sgmodule b/Surge/lxk0301_Task.sgmodule.sgmodule index 08b3479b..72656fc7 100644 --- a/Surge/lxk0301_Task.sgmodule.sgmodule +++ b/Surge/lxk0301_Task.sgmodule.sgmodule @@ -58,7 +58,7 @@ cron "30 8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scrip #领京豆额外奖励 cron "30 10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_home.js, timeout=750, wake-system=1, tag=领京豆额外奖励 #京东汽车 -cron "30 11 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_car.js, timeout=750, wake-system=1, tag=京东汽车 +cron "0 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_car.js, timeout=750, wake-system=1, tag=京东汽车 #京东快递签到 cron "20 11 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_kd.js, timeout=750, wake-system=1, tag=京东快递签到 #京东直播(活动结束时间未知) diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh index 046099de..dd5a341e 100644 --- a/docker/crontab_list.sh +++ b/docker/crontab_list.sh @@ -75,7 +75,7 @@ # 京东快递签到 23 1 * * * node /scripts/jd_kd.js >> /scripts/logs/jd_kd.log 2>&1 # 京东汽车(签到满500赛点可兑换500京豆) -33 2 * * * node /scripts/jd_car.js >> /scripts/logs/jd_car.log 2>&1 +0 0 * * * 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豆) From 6fdd0c20e22dee7142dc65689389ce9d58132959 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Thu, 31 Dec 2020 18:04:00 +0800 Subject: [PATCH 07/52] =?UTF-8?q?=E7=A7=8D=E8=B1=86=E5=BE=97=E8=B1=86?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=80=E4=B8=8B=E6=94=B6=E5=8F=96=E5=A5=BD?= =?UTF-8?q?=E5=8F=8B=E8=90=A5=E5=85=BB=E6=B6=B2=E7=9A=84=E7=AD=96=E7=95=A5?= =?UTF-8?q?=EF=BC=8C=E5=9C=A820=E7=82=B9=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=EF=BC=8C=E5=8F=AA=E9=9C=80=E6=BB=A1=E8=B6=B3=E5=A5=BD=E5=8F=8B?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E9=87=8F=E8=BE=BE=E5=88=B02=E7=93=B6?= =?UTF-8?q?=E5=8D=B3=E5=8E=BB=E6=94=B6=E5=8F=96=EF=BC=8C=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=BB=A1=E8=B6=B33=E7=93=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_plantBean.js | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/jd_plantBean.js b/jd_plantBean.js index 9497a079..8fbe3d0f 100644 --- a/jd_plantBean.js +++ b/jd_plantBean.js @@ -1,6 +1,6 @@ /* 种豆得豆 脚本更新地址:https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js -更新时间:2020-11-04 +更新时间:2020-12-31 已支持IOS京东双账号,云端N个京东账号 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 注:会自动关注任务中的店铺跟商品,介意者勿使用。 @@ -161,14 +161,27 @@ async function stealFriendWater() { return } if ($.stealFriendList.data && $.stealFriendList.data.friendInfoList && $.stealFriendList.data.friendInfoList.length > 0) { + let nowTimes = new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000); for (let item of $.stealFriendList.data.friendInfoList) { - if (item.nutrCount >= 3) { - // console.log(`可以偷的好友的信息::${JSON.stringify(item)}`); - console.log(`可以偷的好友的信息paradiseUuid::${JSON.stringify(item.paradiseUuid)}`); - await collectUserNutr(item.paradiseUuid); - console.log(`偷取好友营养液情况:${JSON.stringify($.stealFriendRes)}`) - if ($.stealFriendRes.code === '0') { - console.log(`偷取好友营养液成功`) + if (new Date(nowTimes).getHours() === 20) { + if (item.nutrCount >= 2) { + // console.log(`可以偷的好友的信息::${JSON.stringify(item)}`); + console.log(`可以偷的好友的信息paradiseUuid::${JSON.stringify(item.paradiseUuid)}`); + await collectUserNutr(item.paradiseUuid); + console.log(`偷取好友营养液情况:${JSON.stringify($.stealFriendRes)}`) + if ($.stealFriendRes.code === '0') { + console.log(`偷取好友营养液成功`) + } + } + } else { + if (item.nutrCount >= 3) { + // console.log(`可以偷的好友的信息::${JSON.stringify(item)}`); + console.log(`可以偷的好友的信息paradiseUuid::${JSON.stringify(item.paradiseUuid)}`); + await collectUserNutr(item.paradiseUuid); + console.log(`偷取好友营养液情况:${JSON.stringify($.stealFriendRes)}`) + if ($.stealFriendRes.code === '0') { + console.log(`偷取好友营养液成功`) + } } } } From 857aedb4a965ca6d1c88d565c3c7f8e9bba54c5c Mon Sep 17 00:00:00 2001 From: DoveBoy <393366046@qq.com> Date: Fri, 1 Jan 2021 10:33:55 +0800 Subject: [PATCH 08/52] =?UTF-8?q?=E4=BA=91=E5=87=BD=E6=95=B0=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E8=BF=87=E6=9C=9F=E7=9A=84=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 云函数去除过期的活动 --- serverless.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/serverless.yml b/serverless.yml index 98a0be61..1309762e 100644 --- a/serverless.yml +++ b/serverless.yml @@ -46,12 +46,12 @@ inputs: cronExpression: "0 0 0-16/8,20 * * * *" enable: true argument: jd_joy_reward&jd_joy_steal&jd_necklace&jd_live - - timer: #京东全民开红包 #进店领豆 #取关京东店铺商品 #注销京东会员卡 #京东抽奖机 #东东小窝 #秒杀红包雨 #健康抽奖机 + - timer: #京东全民开红包 #进店领豆 #取关京东店铺商品 #注销京东会员卡 #京东抽奖机 #东东小窝 #健康抽奖机 parameters: - name: redPacket_shop_unsubscribe_unbind_lotteryMachine_small_home_ms_redrain_health + name: redPacket_shop_unsubscribe_unbind_lotteryMachine_small_home_health cronExpression: "0 10 0 * * * *" enable: true - argument: jd_redPacket&jd_shop&jd_unsubscribe&jd_unbind&jd_lotteryMachine&jd_small_home&jd_ms_redrain&jd_health + argument: jd_redPacket&jd_shop&jd_unsubscribe&jd_unbind&jd_lotteryMachine&jd_small_home&jd_health - timer: # 京东天天加速# 天天提鹅 parameters: name: jd_speed_jd_daily_egg @@ -64,18 +64,18 @@ inputs: cronExpression: "0 15 * * * * *" enable: true argument: jd_superMarket - - timer: #京豆变动通知 #疯狂的joy #京东排行榜 #领京豆额外奖励 #京东健康APP + - timer: #京豆变动通知 #疯狂的joy #京东排行榜 #领京豆额外奖励 parameters: - name: bean_change_crazy_joy_rankingList_bean_home_jdh + name: bean_change_crazy_joy_rankingList_bean_home cronExpression: "0 30 7 * * * *" enable: true - argument: jd_bean_change&jd_crazy_joy&jd_rankingList&jd_bean_home&jd_car&jd_jdh - - timer: #金融养猪 #十元街 #京东快递 #发现-看一看 #京东赚赚 #金融打卡领年终奖 + argument: jd_bean_change&jd_crazy_joy&jd_rankingList&jd_bean_home&jd_car + - timer: #金融养猪 #京东快递 #京东赚赚 parameters: - name: pigPet_syj_kd_watch_jdzz_jr_sign + name: pigPet_kd_jdzz cronExpression: "0 3 1 * * * *" enable: true - argument: jd_pigPet&jd_syj&jd_kd&jd_watch&jd_jdzz&jr_sign + argument: jd_pigPet&jd_kd&jd_jdzz environment: # 环境变量 variables: # 环境变量对象 AAA: BBB # 不要删除,用来格式化对齐追加的变量的 From b940f348371fbc71635a52cd300520492e42d4c5 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 15:10:21 +0800 Subject: [PATCH 09/52] Update crontab_list.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 清除过期活动 --- docker/crontab_list.sh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh index dd5a341e..186c1483 100644 --- a/docker/crontab_list.sh +++ b/docker/crontab_list.sh @@ -4,18 +4,6 @@ 50 23 */3 * * rm -rf /scripts/logs/*.log ##############短期活动############## -# 秒杀红包雨(2020.12.31活动过期) -40 8 1-31 12 * node /scripts/jd_ms_redrain.js >> /scripts/logs/jd_ms_redrain.log 2>&1 -# 健康抽奖机(2020.12.31活动过期) -10 0 1-31 12 * node /scripts/jd_health.js >> /scripts/logs/jd_health.log 2>&1 -# 直播红包雨(2020.12.31活动过期) -1 0,20,9-23/2 15-31 12 * node /scripts/jd_live_redrain.js >> /scripts/logs/jd_live_redrain.log 2>&1 -# 京东金融打卡领年终奖(2020.12.31活动过期) -10 6 1-31 12 * node /scripts/jr_sign.js >> /scripts/logs/jr_sign.log 2>&1 -# 京东健康APP集汪汪卡瓜分百万红包(2021.1.6活动过期) -10 8 * * * node /scripts/jd_jdh.js >> /scripts/logs/jd_jdh.log 2>&1 -# crazyJoy自动每日任务 -10 7 * * * node /scripts/jd_crazy_joy.js >> /scripts/logs/jd_crazy_joy.log 2>&1 ##############长期活动############## # 签到 @@ -84,7 +72,7 @@ 10 11 * * * node /scripts/jd_jdzz.js >> /scripts/logs/jd_jdzz.log 2>&1 # 宠汪汪邀请助力 10 10,11 * * * node /scripts/jd_joy_run.js >> /scripts/logs/jd_joy_run.log 2>&1 -# 京东发现-看一看,看40个视频领80京豆(非常耗时) -13 11,14 * * * node /scripts/jd_watch.js >> /scripts/logs/jd_watch.log 2>&1 # 注销京东已开的店铺会员,不是注销京东plus会员,个别店铺无法注销 44 4 * * 6 node /scripts/jd_unbind.js >> /scripts/logs/jd_unbind.log 2>&1 +# crazyJoy自动每日任务 +10 7 * * * node /scripts/jd_crazy_joy.js >> /scripts/logs/jd_crazy_joy.log 2>&1 From 31ea059a5cbd0662fba7a86ae44adfa17941fe23 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 15:57:39 +0800 Subject: [PATCH 10/52] =?UTF-8?q?=E5=81=A5=E5=BA=B7=E6=8A=BD=E5=A5=96?= =?UTF-8?q?=E6=9C=BA=E8=BF=98=E8=83=BD=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/crontab_list.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh index 186c1483..15540fe8 100644 --- a/docker/crontab_list.sh +++ b/docker/crontab_list.sh @@ -4,7 +4,8 @@ 50 23 */3 * * rm -rf /scripts/logs/*.log ##############短期活动############## - +# 健康抽奖机(2020.12.31活动过期) +10 0 1-31 12 * node /scripts/jd_health.js >> /scripts/logs/jd_health.log 2>&1 ##############长期活动############## # 签到 0 0,18 * * * cd /scripts && node jd_bean_sign.js >> /scripts/logs/jd_bean_sign.log 2>&1 From bc05c74ec467ac51121156a0795720e84e9dec3a Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 16:30:51 +0800 Subject: [PATCH 11/52] =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E5=B7=B2=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E6=B4=BB=E5=8A=A8=E7=9A=84=E8=84=9A=E6=9C=AC,?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=9A=E7=9F=A5=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Loon/lxk0301_LoonTask.conf | 10 +++++----- Surge/lxk0301_Task.sgmodule.sgmodule | 8 -------- docker/crontab_list.sh | 2 +- jd_ds.js | 11 +++++++++-- jd_ms_redrain.js | 10 ++++++++-- jd_watch.js | 18 ++++++++++++++---- jr_sign.js | 11 +++++++++-- 7 files changed, 46 insertions(+), 24 deletions(-) diff --git a/Loon/lxk0301_LoonTask.conf b/Loon/lxk0301_LoonTask.conf index 181904f8..63977d1f 100644 --- a/Loon/lxk0301_LoonTask.conf +++ b/Loon/lxk0301_LoonTask.conf @@ -91,7 +91,7 @@ http-response ^https:\/\/jdjoy\.jd\.com\/pet\/getPetTreasureBox|^https:\/\/draw\ http-response ^https:\/\/account\.huami\.com\/v2\/client\/login script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, requires-body=true, timeout=10, tag=小米运动获取Token # 京东代属 -cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ds.js, tag=京东代属 +# cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ds.js, tag=京东代属 # 京东快递 cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_kd.js, tag=京东快递签到 @@ -107,18 +107,18 @@ cron "3 8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_script # 京东赚赚 cron "10 11 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdzz.js, tag=京东赚赚 # 京东秒杀红包雨 -cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ms_redrain.js, tag=秒杀红包雨 +# cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ms_redrain.js, tag=秒杀红包雨 #注销京东店铺会员卡 cron "23 12 * * 6" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_unbind.js, tag=注销京东店铺会员卡 # 京东直播 cron "10-20/5 12 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live.js, tag=京东直播 # 京东看一看 -cron "40 9,10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_watch.js, tag=京东看一看 +# cron "40 9,10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_watch.js, tag=京东看一看 #直播红包雨 -cron "1 0,20,9-23/2 15-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live_redrain.js, tag=直播红包雨 +# cron "1 0,20,9-23/2 15-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live_redrain.js, tag=直播红包雨 # 金融打卡领年终奖 -cron "10 6 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jr_sign.js, tag=金融打卡领年终奖 +# cron "10 6 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jr_sign.js, tag=金融打卡领年终奖 # 健康抽奖机 cron "10 0 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_health.js,tag=健康抽奖机 # 疯狂的joy日常任务 diff --git a/Surge/lxk0301_Task.sgmodule.sgmodule b/Surge/lxk0301_Task.sgmodule.sgmodule index 72656fc7..ac722056 100644 --- a/Surge/lxk0301_Task.sgmodule.sgmodule +++ b/Surge/lxk0301_Task.sgmodule.sgmodule @@ -53,8 +53,6 @@ cron "40 * * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scrip cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js, timeout=650, wake-system=1, tag=东东小窝 #十元街 cron "40 8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_syj.js, timeout=650, wake-system=1, tag=十元街 -#京东代属(仅京东学生认证用户可用) -cron "30 8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ds.js, timeout=650, wake-system=1, tag=京东代属 #领京豆额外奖励 cron "30 10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_home.js, timeout=750, wake-system=1, tag=领京豆额外奖励 #京东汽车 @@ -74,12 +72,6 @@ cron "20 12 * * 6" script-path=https://raw.githubusercontent.com/lxk0301/jd_scri #疯狂的joy日常任务 cron "30 8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_crazy_joy.js, timeout=1750, wake-system=1, tag=疯狂的joy日常任务 #以下为短期活动 -#金融打卡领年终奖 -cron "30 7 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jr_sign.js, timeout=750, wake-system=1, tag=金融打卡领年终奖 #健康抽奖机 cron "30 2 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_health.js, timeout=750, wake-system=1, tag=健康抽奖机 -#直播红包雨(2020-12-31活动结束) -cron "1 0,20,9-23/2 15-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live_redrain.js, timeout=750, wake-system=1, tag=直播红包雨 -#秒杀红包雨(2020-12-31活动结束) -cron "20 9 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_ms_redrain.js, timeout=750, wake-system=1, tag=秒杀红包雨 diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh index 15540fe8..29945110 100644 --- a/docker/crontab_list.sh +++ b/docker/crontab_list.sh @@ -60,7 +60,7 @@ # 十元街 36 8,18 * * * node /scripts/jd_syj.js >> /scripts/logs/jd_syj.log 2>&1 # 京东代属(注:限校园用户可使用) -36 9 * * * node /scripts/jd_ds.js >> /scripts/logs/jd_ds.log 2>&1 +# 36 9 * * * node /scripts/jd_ds.js >> /scripts/logs/jd_ds.log 2>&1 # 京东快递签到 23 1 * * * node /scripts/jd_kd.js >> /scripts/logs/jd_kd.log 2>&1 # 京东汽车(签到满500赛点可兑换500京豆) diff --git a/jd_ds.js b/jd_ds.js index aa5bac6c..46381bf9 100644 --- a/jd_ds.js +++ b/jd_ds.js @@ -87,8 +87,15 @@ const JD_API_HOST = 'https://api.m.jd.com/'; }) function showMsg() { - return new Promise(resolve => { - $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`); + return new Promise(async resolve => { + // $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`); + let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000; + if (nowTime > new Date('2020/12/31 23:59:59+08:00').getTime()) { + $.msg($.name, '活动已结束', `咱江湖再见\nhttps://github.com/lxk0301/jd_scripts`, {"open-url": "https://github.com/lxk0301/jd_scripts"}); + if ($.isNode()) await notify.sendNotify($.name + '活动已结束', `咱江湖再见\n https://github.com/lxk0301/jd_scripts`) + } else { + $.msg($.name, '', `京东账号${$.index} ${$.nickName}\n${message}`); + } resolve() }) } diff --git a/jd_ms_redrain.js b/jd_ms_redrain.js index c0e82585..c2ea858e 100644 --- a/jd_ms_redrain.js +++ b/jd_ms_redrain.js @@ -83,8 +83,14 @@ const JD_API_HOST = 'https://api.m.jd.com/api'; }) function showMsg() { - return new Promise(resolve => { - $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`); + return new Promise(async resolve => { + let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000; + if (nowTime > new Date('2020/12/31 23:59:59+08:00').getTime()) { + $.msg($.name, '活动已结束', `咱江湖再见\nhttps://github.com/lxk0301/jd_scripts`, {"open-url": "https://github.com/lxk0301/jd_scripts"}); + if ($.isNode()) await notify.sendNotify($.name + '活动已结束', `咱江湖再见\n https://github.com/lxk0301/jd_scripts`) + } else { + $.msg($.name, '', `京东账号${$.index} ${$.nickName}\n${message}`); + } resolve() }) } diff --git a/jd_watch.js b/jd_watch.js index 499a2fe2..f1f9f25a 100644 --- a/jd_watch.js +++ b/jd_watch.js @@ -188,6 +188,7 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action'; continue } await jdHealth() + await showMsg(); } } })() @@ -200,8 +201,8 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action'; async function jdHealth() { $.bean = 0 await getTaskList() - console.log(`${$.name}浏览次数:${$.task.times}/${$.task.maxTimes}`) if($.task) { + console.log(`${$.name}浏览次数:${$.task.times}/${$.task.maxTimes}`) let i = 0, j = $.task.times while(j < $.task.maxTimes) { if (!acceptBody[i]) break @@ -220,8 +221,15 @@ async function jdHealth() { } function showMsg() { - return new Promise(resolve => { - $.msg($.name, '', `京东账号${$.index} ${$.nickName}\n${message}`); + return new Promise(async resolve => { + // $.msg($.name, '', `京东账号${$.index} ${$.nickName}\n${message}`); + let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000; + if (nowTime > new Date('2020/12/31 23:59:59+08:00').getTime()) { + $.msg($.name, '活动已结束', `咱江湖再见\nhttps://github.com/lxk0301/jd_scripts`, {"open-url": "https://github.com/lxk0301/jd_scripts"}); + if ($.isNode()) await notify.sendNotify($.name + '活动已结束', `咱江湖再见\n https://github.com/lxk0301/jd_scripts`) + } else { + $.msg($.name, '', `京东账号${$.index} ${$.nickName}\n${message}`); + } resolve() }) } @@ -237,7 +245,9 @@ function getTaskList() { } else { if (safeGet(data)) { data = JSON.parse(data); - $.task = data['data']['discTasks'][1] + if (data.busiCode === '0') { + $.task = data['data']['discTasks'][1] + } } } } catch (e) { diff --git a/jr_sign.js b/jr_sign.js index b7e6089a..40c9a018 100644 --- a/jr_sign.js +++ b/jr_sign.js @@ -78,8 +78,14 @@ const JD_API_HOST = 'https://api.m.jd.com/api'; }) function showMsg() { - return new Promise(resolve => { - $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`); + return new Promise(async resolve => { + let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000; + if (nowTime > new Date('2020/12/31 23:59:59+08:00').getTime()) { + $.msg($.name, '活动已结束', `咱江湖再见\nhttps://github.com/lxk0301/jd_scripts`, {"open-url": "https://github.com/lxk0301/jd_scripts"}); + if ($.isNode()) await notify.sendNotify($.name + '活动已结束', `咱江湖再见\n https://github.com/lxk0301/jd_scripts`) + } else { + $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`); + } resolve() }) } @@ -96,6 +102,7 @@ function sign() { if (safeGet(data)) { data = JSON.parse(data); console.log(data.resultData.message) + message += `${data.resultData.message}` } } } catch (e) { From 30eebc81e0fb7984870f01e056f9903a392fafd0 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 16:59:35 +0800 Subject: [PATCH 12/52] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=81=E5=85=83?= =?UTF-8?q?=E8=A1=97=E7=AD=BE=E5=88=B0=E5=BE=97=E4=BA=AC=E8=B1=86=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_syj.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jd_syj.js b/jd_syj.js index cd6dabfa..ea75fc27 100644 --- a/jd_syj.js +++ b/jd_syj.js @@ -2,7 +2,7 @@ * @Author: lxk0301 https://github.com/lxk0301 * @Date: 2020-11-27 09:19:21 * @Last Modified by: lxk0301 - * @Last Modified time: 2020-11-27 09:58:02 + * @Last Modified time: 2021-1-1 16:58:02 */ /* 十元街脚本,一周签到下来可获得30京豆,一天任意时刻运行一次即可 @@ -93,7 +93,7 @@ function showMsg() { let signFlag = 0; function userSignIn() { return new Promise(resolve => { - const body = {"activityId":"8d6845fe2e77425c82d5078d314d33c5","inviterId":"VMIQlLQqjQyjZokQmv5bIDgq011L0Ov8","channel":"MiniProgram"}; + const body = {"activityId":"ccd8067defcd4787871b7f0c96fcbf5c","inviterId":"","channel":"MiniProgram"}; $.get(taskUrl('userSignIn', body), async (err, resp, data) => { try { if (err) { @@ -122,6 +122,10 @@ function userSignIn() { signFlag ++; await userSignIn(); } + } else if (data.code === 66) { + //此处有时会遇到 服务器繁忙 导致签到失败,故重复三次签到 + $.log(`${$.name}签到失败:${data.msg}`); + message += `【签到】失败,${data.msg}`; } else { console.log(`异常:${JSON.stringify(data)}`) } From e453e1817107d9b036251d5ed204ef34b99f354d Mon Sep 17 00:00:00 2001 From: DoveBoy <393366046@qq.com> Date: Fri, 1 Jan 2021 17:12:32 +0800 Subject: [PATCH 13/52] =?UTF-8?q?=E4=BA=91=E5=87=BD=E6=95=B0=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E6=B7=BB=E5=8A=A0=E6=9C=89=E6=95=88=E7=9A=84=E5=8D=81?= =?UTF-8?q?=E5=85=83=E8=A1=97=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 云函数重新添加有效的十元街活动 --- serverless.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/serverless.yml b/serverless.yml index 1309762e..d78fe00b 100644 --- a/serverless.yml +++ b/serverless.yml @@ -70,12 +70,12 @@ inputs: cronExpression: "0 30 7 * * * *" enable: true argument: jd_bean_change&jd_crazy_joy&jd_rankingList&jd_bean_home&jd_car - - timer: #金融养猪 #京东快递 #京东赚赚 + - timer: #金融养猪 #十元街 #京东快递 #京东赚赚 parameters: - name: pigPet_kd_jdzz + name: pigPet_syj_kd_jdzz cronExpression: "0 3 1 * * * *" enable: true - argument: jd_pigPet&jd_kd&jd_jdzz + argument: jd_pigPet&jd_syj&jd_kd&jd_jdzz environment: # 环境变量 variables: # 环境变量对象 AAA: BBB # 不要删除,用来格式化对齐追加的变量的 From 6611018a9b150300258def8745e831d2c4eb6b6e Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 17:17:34 +0800 Subject: [PATCH 14/52] =?UTF-8?q?=E4=B8=9C=E4=B8=9C=E5=B7=A5=E5=8E=82=20?= =?UTF-8?q?=20=E5=81=9A=E4=BB=BB=E5=8A=A1=E5=A2=9E=E5=8A=A0=E5=BB=B6?= =?UTF-8?q?=E8=BF=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_jdfactory.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jd_jdfactory.js b/jd_jdfactory.js index 5f16249c..b756da1d 100644 --- a/jd_jdfactory.js +++ b/jd_jdfactory.js @@ -355,7 +355,8 @@ async function doTask() { //领取做完任务的奖励 function jdfactory_collectScore(taskToken) { - return new Promise(resolve => { + return new Promise(async resolve => { + await $.wait(1000); $.post(taskPostUrl("jdfactory_collectScore", { taskToken }, "jdfactory_collectScore"), async (err, resp, data) => { try { if (err) { From aed24e3d597bf0f889f9c328561d5541c1d9e355 Mon Sep 17 00:00:00 2001 From: DoveBoy <393366046@qq.com> Date: Fri, 1 Jan 2021 17:20:43 +0800 Subject: [PATCH 15/52] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E6=B4=BB=E5=8A=A8=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 迁移过期的活动脚本 --- jd_jdh.js => activity/jd_jdh.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jd_jdh.js => activity/jd_jdh.js (100%) diff --git a/jd_jdh.js b/activity/jd_jdh.js similarity index 100% rename from jd_jdh.js rename to activity/jd_jdh.js From 776f5d426b8902814c95fefe2d834360f76e6fb7 Mon Sep 17 00:00:00 2001 From: DoveBoy <393366046@qq.com> Date: Fri, 1 Jan 2021 17:21:33 +0800 Subject: [PATCH 16/52] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E6=B4=BB=E5=8A=A8=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 迁移过期的活动脚本 --- jd_live_redrain.js => activity/jd_live_redrain.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jd_live_redrain.js => activity/jd_live_redrain.js (100%) diff --git a/jd_live_redrain.js b/activity/jd_live_redrain.js similarity index 100% rename from jd_live_redrain.js rename to activity/jd_live_redrain.js From 2b8e65e49f57eccf3e2e63dd0da089bb4a234743 Mon Sep 17 00:00:00 2001 From: DoveBoy <393366046@qq.com> Date: Fri, 1 Jan 2021 17:21:58 +0800 Subject: [PATCH 17/52] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E6=B4=BB=E5=8A=A8=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 迁移过期的活动脚本 --- jd_ms_redrain.js => activity/jd_ms_redrain.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jd_ms_redrain.js => activity/jd_ms_redrain.js (100%) diff --git a/jd_ms_redrain.js b/activity/jd_ms_redrain.js similarity index 100% rename from jd_ms_redrain.js rename to activity/jd_ms_redrain.js From 3eb4785f7accbc8ec40da128a6c08829b95325b8 Mon Sep 17 00:00:00 2001 From: DoveBoy <393366046@qq.com> Date: Fri, 1 Jan 2021 17:22:22 +0800 Subject: [PATCH 18/52] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E6=B4=BB=E5=8A=A8=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 迁移过期的活动脚本 --- jd_watch.js => activity/jd_watch.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jd_watch.js => activity/jd_watch.js (100%) diff --git a/jd_watch.js b/activity/jd_watch.js similarity index 100% rename from jd_watch.js rename to activity/jd_watch.js From a4c6f8ec4cba917b80bfcb5f45249735068d0727 Mon Sep 17 00:00:00 2001 From: DoveBoy <393366046@qq.com> Date: Fri, 1 Jan 2021 17:22:45 +0800 Subject: [PATCH 19/52] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E6=B4=BB=E5=8A=A8=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 迁移过期的活动脚本 --- jr_sign.js => activity/jr_sign.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jr_sign.js => activity/jr_sign.js (100%) diff --git a/jr_sign.js b/activity/jr_sign.js similarity index 100% rename from jr_sign.js rename to activity/jr_sign.js From 4960678188337f7bcfff69190cc6a07bdb6c9d6f Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 18:10:12 +0800 Subject: [PATCH 20/52] =?UTF-8?q?jd=5Fcrazy=5Fjoy=5Fcoin.js=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89=E8=B4=AD=E4=B9=B0=E7=AD=89?= =?UTF-8?q?=E7=BA=A7=E5=8A=9F=E8=83=BD=EF=BC=8C=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E4=B8=BA=20BUY=5FJPY=5FLEVEL=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E8=AE=BE=E7=BD=AE=E7=9A=84=E8=B4=AD=E4=B9=B0=E7=AD=89?= =?UTF-8?q?=E7=BA=A7=E5=A4=A7=E4=BA=8E=E6=9C=80=E9=AB=98=E5=8F=AF=E8=B4=AD?= =?UTF-8?q?=E4=B9=B0=E7=AD=89=E7=BA=A7=EF=BC=8C=E5=88=99=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_crazy_joy_coin.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/jd_crazy_joy_coin.js b/jd_crazy_joy_coin.js index 4e4a5a3b..8bf51c43 100644 --- a/jd_crazy_joy_coin.js +++ b/jd_crazy_joy_coin.js @@ -204,6 +204,10 @@ async function jdJxStory() { await $.wait(1000) await getJoyShop() await $.wait(1000) + $.log('当前JOY分布情况') + $.log(`\n${$.joyIds[0]} ${$.joyIds[1]} ${$.joyIds[2]} ${$.joyIds[3]}`) + $.log(`${$.joyIds[4]} ${$.joyIds[5]} ${$.joyIds[6]} ${$.joyIds[7]}`) + $.log(`${$.joyIds[8]} ${$.joyIds[9]} ${$.joyIds[10]} ${$.joyIds[11]}\n`) for (let i = 0; i < $.joyIds.length; ++i) { if (!$.canBuy) { $.log(`金币不足,跳过购买`) @@ -280,8 +284,14 @@ function getJoyShop() { data = JSON.parse(data); if (data.success && data.data && data.data.shop) { const shop = data.data.shop.filter(vo => vo.status === 1) || [] - $.buyJoyLevel = shop.length ? shop[shop.length - 1]['joyId'] : 1 - $.cost = shop.length ? shop[shop.length - 1]['coins'] : Infinity + $.buyJoyLevel = shop.length ? shop[shop.length - 1]['joyId'] : 1;//可购买的最大等级 + if ($.isNode() && process.env.BUY_JPY_LEVEL) { + $.log(`当前可购买的最高JOY等级为${$.buyJoyLevel}级\n`) + $.buyJoyLevel = (process.env.BUY_JPY_LEVEL * 1) > $.buyJoyLevel ? $.buyJoyLevel : process.env.BUY_JPY_LEVEL * 1; + $.cost = shop[$.buyJoyLevel - 1]['coins'] + } else { + $.cost = shop.length ? shop[shop.length - 1]['coins'] : Infinity + } } } } catch (e) { From f314a69af7b25452eb1b742c69562f60e71eb4f6 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 18:11:12 +0800 Subject: [PATCH 21/52] fix --- jd_crazy_joy_coin.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jd_crazy_joy_coin.js b/jd_crazy_joy_coin.js index 8bf51c43..669bf766 100644 --- a/jd_crazy_joy_coin.js +++ b/jd_crazy_joy_coin.js @@ -204,10 +204,12 @@ async function jdJxStory() { await $.wait(1000) await getJoyShop() await $.wait(1000) - $.log('当前JOY分布情况') - $.log(`\n${$.joyIds[0]} ${$.joyIds[1]} ${$.joyIds[2]} ${$.joyIds[3]}`) - $.log(`${$.joyIds[4]} ${$.joyIds[5]} ${$.joyIds[6]} ${$.joyIds[7]}`) - $.log(`${$.joyIds[8]} ${$.joyIds[9]} ${$.joyIds[10]} ${$.joyIds[11]}\n`) + if ($.joyIds && $.joyIds.length > 0) { + $.log('当前JOY分布情况') + $.log(`\n${$.joyIds[0]} ${$.joyIds[1]} ${$.joyIds[2]} ${$.joyIds[3]}`) + $.log(`${$.joyIds[4]} ${$.joyIds[5]} ${$.joyIds[6]} ${$.joyIds[7]}`) + $.log(`${$.joyIds[8]} ${$.joyIds[9]} ${$.joyIds[10]} ${$.joyIds[11]}\n`) + } for (let i = 0; i < $.joyIds.length; ++i) { if (!$.canBuy) { $.log(`金币不足,跳过购买`) From 1685687158cd4e4dfd3fff7d02c2ad8e06fb2155 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 18:46:08 +0800 Subject: [PATCH 22/52] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=B8=8E=E4=BA=AC=E4=B8=9C=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E6=97=B6=E9=97=B4=E4=B9=8B=E5=B7=AE=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_joy_reward.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/jd_joy_reward.js b/jd_joy_reward.js index 6878e769..d12d1c44 100644 --- a/jd_joy_reward.js +++ b/jd_joy_reward.js @@ -60,6 +60,7 @@ const JD_API_HOST = 'https://jdjoy.jd.com'; } continue } + console.log(`本地时间与京东服务器时间差:${await get_diff_time()}`); await joyReward(); // $.msg($.name, '兑换脚本暂不能使用', `请停止使用,等待后期更新\n如果新版本兑换您有兑换机会,请抓包兑换\n再把抓包数据发送telegram用户@lxk0301`); } @@ -273,6 +274,35 @@ function TotalBean() { }) }) } +function getJDServerTime() { + return new Promise(resolve => { + // console.log(Date.now()) + $.get({url: "https://a.jd.com//ajax/queryServerData.html",headers:{ + "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88" + }}, async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} 获取京东服务器时间失败,请检查网路重试`) + } else { + data = JSON.parse(data); + $.jdTime = data['serverTime']; + // console.log(data['serverTime']); + // console.log(data['serverTime'] - Date.now()) + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve($.jdTime); + } + }) + }) +} +async function get_diff_time() { + // console.log(await getJDServerTime()) + let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000; + return nowTime - await getJDServerTime(); +} function jsonParse(str) { if (typeof str == "string") { try { From 48a1a5ad85fd2aa4b978d85ee4665608b6f8cddd Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 19:00:58 +0800 Subject: [PATCH 23/52] Update jd_joy_reward.js --- jd_joy_reward.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jd_joy_reward.js b/jd_joy_reward.js index d12d1c44..26bf0c0f 100644 --- a/jd_joy_reward.js +++ b/jd_joy_reward.js @@ -60,7 +60,7 @@ const JD_API_HOST = 'https://jdjoy.jd.com'; } continue } - console.log(`本地时间与京东服务器时间差:${await get_diff_time()}`); + console.log(`本地时间与京东服务器时间差(毫秒):${await get_diff_time()}`); await joyReward(); // $.msg($.name, '兑换脚本暂不能使用', `请停止使用,等待后期更新\n如果新版本兑换您有兑换机会,请抓包兑换\n再把抓包数据发送telegram用户@lxk0301`); } From 564e4a30f2cfc7ab78c329d07e363ac6dffd07e7 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 1 Jan 2021 22:14:14 +0800 Subject: [PATCH 24/52] Update jd_dreamFactory.js --- jd_dreamFactory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js index 2333f2f8..11687c97 100644 --- a/jd_dreamFactory.js +++ b/jd_dreamFactory.js @@ -34,7 +34,7 @@ const randomCount = $.isNode() ? 20 : 5; let tuanActiveId = `6S9y4sJUfA2vPQP6TLdVIQ==`; const jxOpenUrl = `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`; let cookiesArr = [], cookie = '', message = ''; -const inviteCodes = ['V5LkjP4WRyjeCKR9VRwcRX0bBuTz7MEK0-E99EJ7u0k=', 'PDPM257r_KuQhil2Y7koNw==', "gB99tYLjvPcEFloDgamoBw==", '-OvElMzqeyeGBWazWYjI1Q==', 'GFwo6PntxDHH95ZRzZ5uAg==']; +const inviteCodes = ['V5LkjP4WRyjeCKR9VRwcRX0bBuTz7MEK0-E99EJ7u0k=@0WtCMPNq7jekehT6d3AbFw==', 'PDPM257r_KuQhil2Y7koNw==', "gB99tYLjvPcEFloDgamoBw==", '-OvElMzqeyeGBWazWYjI1Q==', 'GFwo6PntxDHH95ZRzZ5uAg==']; const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; if ($.isNode()) { Object.keys(jdCookieNode).forEach((item) => { From 0bfa49c86c36bbb26fc8f30e568bf1da0bdf52e7 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Sat, 2 Jan 2021 10:41:57 +0800 Subject: [PATCH 25/52] Update lxk0301_Task.sgmodule.sgmodule --- Surge/lxk0301_Task.sgmodule.sgmodule | 2 -- 1 file changed, 2 deletions(-) diff --git a/Surge/lxk0301_Task.sgmodule.sgmodule b/Surge/lxk0301_Task.sgmodule.sgmodule index ac722056..0419fcbe 100644 --- a/Surge/lxk0301_Task.sgmodule.sgmodule +++ b/Surge/lxk0301_Task.sgmodule.sgmodule @@ -61,8 +61,6 @@ cron "0 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_script cron "20 11 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_kd.js, timeout=750, wake-system=1, tag=京东快递签到 #京东直播(活动结束时间未知) cron "20 12 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_live.js, timeout=750, wake-system=1, tag=京东直播 -#京东看一看 -cron "40 9,10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_watch.js, timeout=7750, wake-system=1, tag=京东看一看 #京东健康 cron "20 23 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdh.js, timeout=750, wake-system=1, tag=京东健康 #京东赚赚 From 61b73695399090587f7b4538fbcc95df84f235b2 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Sat, 2 Jan 2021 10:46:09 +0800 Subject: [PATCH 26/52] Update lxk0301_Task.sgmodule.sgmodule --- Surge/lxk0301_Task.sgmodule.sgmodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Surge/lxk0301_Task.sgmodule.sgmodule b/Surge/lxk0301_Task.sgmodule.sgmodule index 0419fcbe..f359b012 100644 --- a/Surge/lxk0301_Task.sgmodule.sgmodule +++ b/Surge/lxk0301_Task.sgmodule.sgmodule @@ -71,5 +71,5 @@ cron "20 12 * * 6" script-path=https://raw.githubusercontent.com/lxk0301/jd_scri cron "30 8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_crazy_joy.js, timeout=1750, wake-system=1, tag=疯狂的joy日常任务 #以下为短期活动 #健康抽奖机 -cron "30 2 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_health.js, timeout=750, wake-system=1, tag=健康抽奖机 +cron "30 2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_health.js, timeout=750, wake-system=1, tag=健康抽奖机 From 5b6fbb1dd1909855b773d68bf467598d188309be Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Sat, 2 Jan 2021 21:42:52 +0800 Subject: [PATCH 27/52] add --- backUp/iOS_Weather_AQI_Standard.js | 138 +++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 backUp/iOS_Weather_AQI_Standard.js diff --git a/backUp/iOS_Weather_AQI_Standard.js b/backUp/iOS_Weather_AQI_Standard.js new file mode 100644 index 00000000..dfb22941 --- /dev/null +++ b/backUp/iOS_Weather_AQI_Standard.js @@ -0,0 +1,138 @@ +// Developed by Hackl0us (https://github.com/hackl0us) + +// STEP 1: 前往 https://aqicn.org/data-platform/token/ 注册账户,将申请的 API Token 填入下方 +let aqicnToken = '' +// STEP 2: 参考下方配置片段,在代理工具的配置文件中添加对应的配置。注意:script-path 后应该替换为添加 apicnToken 值后的脚本路径 +/* +===============Surge================= +[Script] +AQI-US = type=http-response, pattern=https://weather-data.apple.com/v1/weather/[\w-]+/[0-9]+\.[0-9]+/[0-9]+\.[0-9]+\?, requires-body=true, script-path=/path/to/iOS_Weather_AQI_Standard.js + +[MITM] +hostname = weather-data.apple.com +*/ +const $ = new Env('牛逼天气'); +aqicnToken = $.getdata('hackl0us_aqi_token'); + +const AirQualityStandard = { + CN: 'HJ6332012.1', + US: 'EPA_NowCast.1' +} + +const AirQualityLevel = { + GOOD: 1, + MODERATE: 2, + UNHEALTHY_FOR_SENSITIVE: 3, + UNHEALTHY: 4, + VERY_UNHEALTHY: 5, + HAZARDOUS: 6 +} + +const coordRegex = /https:\/\/weather-data\.apple\.com\/v1\/weather\/[\w-]+\/([0-9]+\.[0-9]+)\/([0-9]+\.[0-9]+)\?/ +const [_, lat, lng] = $request.url.match(coordRegex) + +function classifyAirQualityLevel(aqiIndex) { + if (aqiIndex >= 0 && aqiIndex <= 50) { + return AirQualityLevel.GOOD; + } else if (aqiIndex >= 51 && aqiIndex <= 100) { + return AirQualityLevel.MODERATE; + } else if (aqiIndex >= 101 && aqiIndex <= 150) { + return AirQualityLevel.UNHEALTHY_FOR_SENSITIVE; + } else if (aqiIndex >= 151 && aqiIndex <= 200) { + return AirQualityLevel.UNHEALTHY; + } else if (aqiIndex >= 201 && aqiIndex <= 300) { + return AirQualityLevel.VERY_UNHEALTHY; + } else if (aqiIndex >= 301 && aqiIndex <= 500) { + return AirQualityLevel.HAZARDOUS; + } +} + +function modifyWeatherResp(weatherRespBody, aqicnRespBody) { + let weatherRespJson = JSON.parse(weatherRespBody) + let aqicnRespJson = JSON.parse(aqicnRespBody).data + weatherRespJson.air_quality = constructAirQuailityNode(aqicnRespJson) + return JSON.stringify(weatherRespJson) +} + +function getPrimaryPollutant(pollutant) { + switch (pollutant) { + case 'co': + return 'CO2'; + case 'so2': + return 'SO2'; + case 'no2': + return 'NO2'; + case 'pm25': + return 'PM2.5'; + case 'pm10': + return 'PM10'; + case 'o3': + return 'OZONE'; + default: + console.log('Unknown pollutant ' + pollutant); + } +} + +function constructAirQuailityNode(aqicnData) { + let airQualityNode = { "source": "", "learnMoreURL": "", "isSignificant": true, "airQualityCategoryIndex": 1, "airQualityScale": "", "airQualityIndex": 0, "pollutants": { "CO": { "name": "CO", "amount": 0, "unit": "μg/m3" }, "SO2": { "name": "SO2", "amount": 0, "unit": "μg/m3" }, "NO2": { "name": "NO2", "amount": 0, "unit": "μg/m3" }, "PM2.5": { "name": "PM2.5", "amount": 0, "unit": "μg/m3" }, "OZONE": { "name": "OZONE", "amount": 0, "unit": "μg/m3" }, "PM10": { "name": "PM10", "amount": 0, "unit": "μg/m3" } }, "metadata": { "reported_time": 0, "longitude": 0, "provider_name": "aqicn.org", "expire_time": 2, "provider_logo": "https://i.loli.net/2020/12/27/UqW23eZLFAIbxGV.png", "read_time": 2, "latitude": 0, "v": 1, "language": "", "data_source": 0 }, "name": "AirQuality", "primaryPollutant": "" } + const aqicnIndex = aqicnData.aqi + airQualityNode.source = aqicnData.city.name + airQualityNode.learnMoreURL = aqicnData.city.url + '/cn/m' + airQualityNode.airQualityCategoryIndex = classifyAirQualityLevel(aqicnIndex) + airQualityNode.airQualityScale = AirQualityStandard.US + airQualityNode.airQualityIndex = aqicnIndex + airQualityNode.pollutants.CO.amount = aqicnData.iaqi.co?.v || -1 + airQualityNode.pollutants.SO2.amount = aqicnData.iaqi.so2?.v || -1 + airQualityNode.pollutants.NO2.amount = aqicnData.iaqi.no2?.v || -1 + airQualityNode.pollutants["PM2.5"].amount = aqicnData.iaqi.pm25?.v || -1 + airQualityNode.pollutants.OZONE.amount = aqicnData.iaqi.o3?.v || -1 + airQualityNode.pollutants.PM10.amount = aqicnData.iaqi.pm10?.v || -1 + airQualityNode.metadata.latitude = aqicnData.city.geo[0] + airQualityNode.metadata.longitude = aqicnData.city.geo[1] + airQualityNode.metadata.read_time = roundHours(new Date(), 'down') + airQualityNode.metadata.expire_time = roundHours(new Date(), 'up') + airQualityNode.metadata.reported_time = aqicnData.time.v + //airQualityNode.metadata.language = $request.headers['Accept-Language'] + airQualityNode.primaryPollutant = getPrimaryPollutant(aqicnData.dominentpol) + return airQualityNode +} + +function roundHours(time, method) { + switch (method) { + case 'up': + time.setHours(time.getHours() + Math.ceil(time.getMinutes() / 60)); + break; + case 'down': + time.setHours(time.getHours() + Math.floor(time.getMinutes() / 60)); + break; + default: + console.log("Error rounding method"); + } + time.setMinutes(2, 0, 0); + return time; +} + +// $httpClient.get(`https://api.waqi.info/feed/geo:${lat};${lng}/?token=${aqicnToken}`, function (error, _response, data) { +// if (error) { +// let body = $response.body +// $done({ body }) +// } else { +// let body = modifyWeatherResp($response.body, data) +// $done({ body }) +// } +// }); +$.get({ url: `https://api.waqi.info/feed/geo:${lat};${lng}/?token=${aqicnToken}`, headers: $request.headers },(err, resp, data) => { + try { + if (err) { + $.logErr(err, resp); + } else { + console.log(`${JSON.stringify(resp.body)}`); + let body = modifyWeatherResp($response.body, resp.body); + $.done({body}); + } + } catch (e) { + $.logErr(e, resp); + $.done(); + } +}); +function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file From 7d035a4661894ce0cd744d56cd24f4490c638cb8 Mon Sep 17 00:00:00 2001 From: Akira Date: Sat, 2 Jan 2021 23:27:27 +0800 Subject: [PATCH 28/52] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89shell=E8=84=9A=E6=9C=AC=E8=87=AA=E5=8A=A8mod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Readme.md | 26 ++++++++++++++++++++------ docker/default_task.sh | 23 ++++++++++++++++++++++- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/docker/Readme.md b/docker/Readme.md index beb03302..922a84a7 100644 --- a/docker/Readme.md +++ b/docker/Readme.md @@ -1,4 +1,24 @@ ### Usage +```diff ++ 2021-01-03更新 增加 CUSTOM_SHELL_FILE 参数配置执行自定义shell脚本 ++ 例1:配置远程shell脚本, 我自己写了一个shell脚本https://raw.githubusercontent.com/iouAkira/someDockerfile/master/jd_scripts/shell_script_mod.sh 内容很简单下载惊喜农场并添加定时任务 ++ CUSTOM_SHELL_FILE=https://raw.githubusercontent.com/iouAkira/someDockerfile/master/jd_scripts/shell_script_mod.sh ++ ++ 例2:配置docker挂载本地自定义shell脚本,/scripts/docker/shell_script_mod.sh 为你在docker-compose.yml里面挂载到容器里面绝对路径 ++ CUSTOM_SHELL_FILE=/scripts/docker/shell_script_mod.sh ++ ++ tip:如果使用远程自定义,请保证网络畅通或者选择合适的国内仓库,例如有部分人的容器里面就下载不到github的raw文件,那就可以把自己的自定义shell写在gitee上,或者换本地挂载 ++ 如果是 docker 挂载本地,请保重文件挂载进去了,并且配置的是绝对路径。 ++ 自定义 shell 脚本里面如果要加 crontab 任务请使用 echo 追加到 /scripts/docker/merged_list_file.sh 里面否者不生效 ++ 注⚠️ 建议无shell能力的不要轻易使用,当然你可以找别人写好适配了这个docker镜像的脚本直接远程配置 ++ 上面写了这么多如果还看不懂,不建议使用该变量功能。 +_____ +! ⚠️⚠️⚠️2020-12-11更新镜像启动方式,虽然兼容旧版的运行启动方式,但是强烈建议更新镜像和配置后使用 +! 更新后`command:`指令配置不再需要 +! 更新后可以使用自定义任务文件追加在默任务文件之后,比以前的完全覆盖多一个选择 +! - 新的自定两个环境变量为 `CUSTOM_LIST_MERGE_TYPE`:自定文件的生效方式可选值为`append`,`overwrite`默认为`append` ; `CUSTOM_LIST_FILE`: 自定义文件的名字 +! 更新镜像增减镜像更新通知,以后镜像如果更新之后,会通知用户更新 +``` > 推荐使用`docker-compose`所以这里只介绍`docker-compose`使用方式 - `docker-compose` 安装(群晖nas docker自带安装了docker-compose) @@ -21,12 +41,6 @@ pip install docker-compose ### 如果需要使用 docker 多个账户独立并发执行定时任务,[参考这里](https://github.com/iouAkira/scripts/blob/patch-1/docker/docker%E5%A4%9A%E8%B4%A6%E6%88%B7%E4%BD%BF%E7%94%A8%E7%8B%AC%E7%AB%8B%E5%AE%B9%E5%99%A8%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md#%E4%BD%BF%E7%94%A8%E6%AD%A4%E6%96%B9%E5%BC%8F%E8%AF%B7%E5%85%88%E7%90%86%E8%A7%A3%E5%AD%A6%E4%BC%9A%E4%BD%BF%E7%94%A8docker%E5%8A%9E%E6%B3%95%E4%B8%80%E7%9A%84%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F) -⚠️⚠️⚠️2020-12-11更新镜像启动方式,虽然兼容旧版的运行启动方式,但是强烈建议更新镜像和配置后使用 -- 更新后`command:`指令配置不再需要 -- 更新后可以使用自定义任务文件追加在默任务文件之后,比以前的完全覆盖多一个选择 -- - 新的自定两个环境变量为 `CUSTOM_LIST_MERGE_TYPE`:自定文件的生效方式可选值为`append`,`overwrite`默认为`append` ; `CUSTOM_LIST_FILE`: 自定义文件的名字 -- 更新镜像增减镜像更新通知,以后镜像如果更新之后,会通知用户更新 - > 注⚠️:前提先理解学会使用这下面的教程 ### 创建一个目录`jd_scripts`用于存放备份配置等数据,迁移重装的时候只需要备份整个jd_scripts目录即可 需要新建的目录文件结构参考如下: diff --git a/docker/default_task.sh b/docker/default_task.sh index caf4f6d1..26da7f0f 100644 --- a/docker/default_task.sh +++ b/docker/default_task.sh @@ -107,7 +107,7 @@ if [ $(grep -c "default_task.sh" $mergedListFile) -eq '0' ]; then echo "52 */1 * * * sh /scripts/docker/default_task.sh |ts >> /scripts/logs/default_task.log 2>&1" >>$mergedListFile fi -if [ $RANDOM_DELAY_MAX ];then +if [ $RANDOM_DELAY_MAX ]; then if [ $RANDOM_DELAY_MAX -ge 1 ]; then echo "已设置随机延迟为 $RANDOM_DELAY_MAX , 设置延迟任务中... " sed -i "/\(jd_bean_sign.js\|jd_blueCoin.js\|jd_joy_reward.js\|jd_joy_steal.js\|jd_joy_feedPets.js\)/!s/node/sleep \$((RANDOM % \$RANDOM_DELAY_MAX)); node/g" $mergedListFile @@ -116,6 +116,27 @@ else echo "未配置随即延迟对应的环境变量,故不设置延迟任务" fi +##增加自定义shell脚本 +if [ 0"$CUSTOM_SHELL_FILE" = "0" ]; then + echo "未配置自定shell脚本文件,跳过执行。" +else + if expr "$CUSTOM_SHELL_FILE" : 'http.*' &>/dev/null; then + echo "自定义shell脚本为远程脚本,开始下在自定义远程脚本。" + wget -O /scripts/docker/shell_script_mod.sh $CUSTOM_SHELL_FILE + echo "下载完成,开始执行..." + sh -x /scripts/docker/shell_script_mod.sh + echo "自定义远程shell脚本下载并执行结束。" + else + if [ !$CUSTOM_SHELL_FILE ]; then + echo "自定义shell脚本为docker挂载脚本文件,但是指定挂载文件不存在,跳过执行。" + else + echo "docker挂载的自定shell脚本,开始执行..." + sh -x $CUSTOM_SHELL_FILE + echo "docker挂载的自定shell脚本,执行结束。" + fi + fi +fi + echo "加载最新的定时任务文件..." crontab $mergedListFile From 71eda6afc47c03caf1785b610616bb31285e0b10 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Mon, 4 Jan 2021 12:22:11 +0800 Subject: [PATCH 29/52] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=9C=E4=B8=9C?= =?UTF-8?q?=E5=B0=8F=E7=AA=9D=E5=9B=A0=E8=A3=85=E9=A5=B0=E9=A2=86=E4=BA=AC?= =?UTF-8?q?=E8=B1=86=E5=8A=9F=E8=83=BD=E4=B8=8B=E7=BA=BF=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Loon/lxk0301_LoonTask.conf | 2 +- docker/crontab_list.sh | 2 +- jd_small_home.js | 40 ++++++++++++++++++++------------------ 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Loon/lxk0301_LoonTask.conf b/Loon/lxk0301_LoonTask.conf index 63977d1f..13ff0c41 100644 --- a/Loon/lxk0301_LoonTask.conf +++ b/Loon/lxk0301_LoonTask.conf @@ -120,6 +120,6 @@ cron "10-20/5 12 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd # 金融打卡领年终奖 # cron "10 6 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jr_sign.js, tag=金融打卡领年终奖 # 健康抽奖机 -cron "10 0 1-31 12 *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_health.js,tag=健康抽奖机 +cron "10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_health.js,tag=健康抽奖机 # 疯狂的joy日常任务 cron "30 8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_crazy_joy.js,tag=疯狂的joy日常任务 diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh index 29945110..4dbf59b8 100644 --- a/docker/crontab_list.sh +++ b/docker/crontab_list.sh @@ -5,7 +5,7 @@ ##############短期活动############## # 健康抽奖机(2020.12.31活动过期) -10 0 1-31 12 * node /scripts/jd_health.js >> /scripts/logs/jd_health.log 2>&1 +10 0 * * * node /scripts/jd_health.js >> /scripts/logs/jd_health.log 2>&1 ##############长期活动############## # 签到 0 0,18 * * * cd /scripts && node jd_bean_sign.js >> /scripts/logs/jd_bean_sign.log 2>&1 diff --git a/jd_small_home.js b/jd_small_home.js index 096519e6..46a21a0b 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-12-23 14:27:20 + * @Last Modified time: 2021-1-4 14:27:20 */ /* 东东小窝 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js @@ -274,25 +274,27 @@ function queryFurnituresCenterList() { 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); - if ($.canBuyList[0].needWoB <= $.woB) { - await furnituresCenterPurchase($.canBuyList[0].id, $.canBuyList[0].jdBeanNum); - } else { - console.log(`\n兑换${$.canBuyList[0].jdBeanNum}京豆失败:当前wo币${$.woB}不够兑换所需的${$.canBuyList[0].needWoB}WO币`) - message += `【装饰领京豆】兑换${$.canBuyList[0].jdBeanNum}京豆失败,原因:WO币不够\n`; + if (data.body) { + let { buy, list } = data.body; + $.canBuyList = []; + list.map((item, index) => { + if (buy.some((buyItem) => buyItem === item.id)) return + $.canBuyList.push(item); + }) + $.canBuyList.sort(sortByjdBeanNum); + if ($.canBuyList[0].needWoB <= $.woB) { + await furnituresCenterPurchase($.canBuyList[0].id, $.canBuyList[0].jdBeanNum); + } else { + console.log(`\n兑换${$.canBuyList[0].jdBeanNum}京豆失败:当前wo币${$.woB}不够兑换所需的${$.canBuyList[0].needWoB}WO币`) + message += `【装饰领京豆】兑换${$.canBuyList[0].jdBeanNum}京豆失败,原因:WO币不够\n`; + } + // for (let canBuyItem of $.canBuyList) { + // if (canBuyItem.needWoB <= $.woB) { + // await furnituresCenterPurchase(canBuyItem.id, canBuyItem.jdBeanNum); + // break + // } + // } } - // for (let canBuyItem of $.canBuyList) { - // if (canBuyItem.needWoB <= $.woB) { - // await furnituresCenterPurchase(canBuyItem.id, canBuyItem.jdBeanNum); - // break - // } - // } } } } From c693e2c98d040a1c248f77c422948da0c0e574c5 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Mon, 4 Jan 2021 12:35:46 +0800 Subject: [PATCH 30/52] =?UTF-8?q?=E4=B8=9C=E4=B8=9C=E5=B7=A5=E5=8E=82?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD=EF=BC=8C=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=94=A8=E6=88=B7=E8=8E=B7=E5=8F=96=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=85=A8=E5=AF=BC=E8=87=B4=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- activity/jd_apple_live.js | 2 +- activity/jd_jxstory.js | 2 +- activity/jd_pubg.js | 2 +- jd_crazy_joy.js | 2 +- jd_dreamFactory.js | 2 +- jd_fruit.js | 2 +- jd_health.js | 2 +- jd_jdfactory.js | 40 +++++++++++++++++++++------------------ jd_jdzz.js | 2 +- jd_pet.js | 2 +- jd_plantBean.js | 2 +- 11 files changed, 32 insertions(+), 28 deletions(-) diff --git a/activity/jd_apple_live.js b/activity/jd_apple_live.js index 26022817..e2d04104 100644 --- a/activity/jd_apple_live.js +++ b/activity/jd_apple_live.js @@ -283,7 +283,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/activity/jd_jxstory.js b/activity/jd_jxstory.js index cd46e3ed..45c79941 100644 --- a/activity/jd_jxstory.js +++ b/activity/jd_jxstory.js @@ -498,7 +498,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/activity/jd_pubg.js b/activity/jd_pubg.js index bed15df4..cc22b60c 100644 --- a/activity/jd_pubg.js +++ b/activity/jd_pubg.js @@ -330,7 +330,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_crazy_joy.js b/jd_crazy_joy.js index a87e8711..f1d1f5d9 100644 --- a/jd_crazy_joy.js +++ b/jd_crazy_joy.js @@ -666,7 +666,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js index 11687c97..713a46f9 100644 --- a/jd_dreamFactory.js +++ b/jd_dreamFactory.js @@ -1305,7 +1305,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_fruit.js b/jd_fruit.js index 03185eb1..2cb8ec94 100644 --- a/jd_fruit.js +++ b/jd_fruit.js @@ -1239,7 +1239,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取个${randomCount}码放到您固定的互助码后面`) + console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_health.js b/jd_health.js index ee4ffe9b..b05005d0 100644 --- a/jd_health.js +++ b/jd_health.js @@ -265,7 +265,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_jdfactory.js b/jd_jdfactory.js index b756da1d..546b7109 100644 --- a/jd_jdfactory.js +++ b/jd_jdfactory.js @@ -108,8 +108,8 @@ function showMsg() { } else { $.log(`京东账号${$.index}${$.nickName}\n${message}`); } - if (new Date().getHours() === 23) { - $.msg($.name, '', `京东账号${$.index}${$.nickName}\n${message}`); + if (new Date().getHours() === 12) { + $.msg($.name, '', `${message}`); } resolve() }) @@ -181,6 +181,7 @@ async function algorithm() { } } else { console.log(`\n此账号${$.index}${$.nickName}暂未选择商品\n`); + message += `京东账号${$.index} ${$.nickName}\n`; message += `已选商品:暂无\n`; message += `心仪商品:${wantProduct ? wantProduct : '暂无'}\n`; if (wantProduct) { @@ -216,17 +217,17 @@ async function algorithm() { } else { console.log(`BoxJs或环境变量暂未提供心仪商品\n如需兑换心仪商品,请提供心仪商品名称\n`); await jdfactory_getProductList(true); - message += `当前剩余最多商品:${$.canMakeList[0].name}\n`; - message += `兑换所需电量:${$.canMakeList[0].fullScore}\n`; + message += `当前剩余最多商品:${$.canMakeList[0] && $.canMakeList[0].name}\n`; + message += `兑换所需电量:${$.canMakeList[0] && $.canMakeList[0].fullScore}\n`; message += `您当前总电量:${$.batteryValue * 1}\n`; - if ($.canMakeList[0].couponCount > 0 && $.batteryValue * 1 >= $.canMakeList[0].fullScore) { + if ($.canMakeList[0] && $.canMakeList[0].couponCount > 0 && $.batteryValue * 1 >= $.canMakeList[0] && $.canMakeList[0].fullScore) { let nowTimes = new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000); if (new Date(nowTimes).getHours() === 12) { - $.msg($.name, '', `京东账号${$.index}${$.nickName}\n${message}【满足】兑换${$.canMakeList[0].name}所需总电量:${$.canMakeList[0].fullScore}\n请点击弹窗直达活动页面\n选择此心仪商品并手动投入电量兑换`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html%22%20%7D'}); - if ($.isNode()) await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】${$.nickName}\n${message}【满足】兑换${$.canMakeList[0].name}所需总电量:${$.canMakeList[0].fullScore}\n请速去活动页面查看`); + $.msg($.name, '', `京东账号${$.index}${$.nickName}\n${message}【满足】兑换${$.canMakeList[0] && $.canMakeList[0] && [0].name}所需总电量:${$.canMakeList[0] && $.canMakeList[0].fullScore}\n请点击弹窗直达活动页面\n选择此心仪商品并手动投入电量兑换`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html%22%20%7D'}); + if ($.isNode()) await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】${$.nickName}\n${message}【满足】兑换${$.canMakeList[0] && $.canMakeList[0].name}所需总电量:${$.canMakeList[0].fullScore}\n请速去活动页面查看`); } } else { - console.log(`\n目前电量${$.batteryValue * 1},不满足兑换 ${$.canMakeList[0].name}所需的 ${$.canMakeList[0].fullScore}电量\n`) + console.log(`\n目前电量${$.batteryValue * 1},不满足兑换 ${$.canMakeList[0] && $.canMakeList[0].name}所需的 ${$.canMakeList[0] && $.canMakeList[0].fullScore}电量\n`) } } } @@ -535,17 +536,20 @@ function jdfactory_getProductList(flag = false) { if (safeGet(data)) { data = JSON.parse(data); if (data.data.bizCode === 0) { + $.canMakeList = []; $.canMakeList = data.data.result.canMakeList;//当前可选商品列表 sellOut:1为已抢光,0为目前可选择 - $.canMakeList.sort(sortCouponCount); - console.log(`商品名称 可选状态 剩余量`) - for (let item of $.canMakeList) { - console.log(`${item.name.slice(-4)} ${item.sellOut === 1 ? '已抢光':'可 选'} ${item.couponCount}`); - } - if (!flag) { + if ($.canMakeList && $.canMakeList.length > 0) { + $.canMakeList.sort(sortCouponCount); + console.log(`商品名称 可选状态 剩余量`) for (let item of $.canMakeList) { - if (item.name.indexOf(wantProduct) > -1 && item.couponCount > 0 && item.sellOut === 0) { - await jdfactory_makeProduct(item.skuId); - break + console.log(`${item.name.slice(-4)} ${item.sellOut === 1 ? '已抢光':'可 选'} ${item.couponCount}`); + } + if (!flag) { + for (let item of $.canMakeList) { + if (item.name.indexOf(wantProduct) > -1 && item.couponCount > 0 && item.sellOut === 0) { + await jdfactory_makeProduct(item.skuId); + break + } } } } @@ -624,7 +628,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_jdzz.js b/jd_jdzz.js index f5da3632..5ea61aa2 100644 --- a/jd_jdzz.js +++ b/jd_jdzz.js @@ -343,7 +343,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_pet.js b/jd_pet.js index 9b19c20f..cde3fd7f 100644 --- a/jd_pet.js +++ b/jd_pet.js @@ -442,7 +442,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取个${randomCount}码放到您固定的互助码后面`) + console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_plantBean.js b/jd_plantBean.js index 8fbe3d0f..c573903e 100644 --- a/jd_plantBean.js +++ b/jd_plantBean.js @@ -521,7 +521,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取个${randomCount}码放到您固定的互助码后面`) + console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } From 608db241102356f0e11d73b2b7c2040e1f99e5be Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Mon, 4 Jan 2021 13:03:49 +0800 Subject: [PATCH 31/52] update --- jd_bean_sign.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jd_bean_sign.js b/jd_bean_sign.js index accf5990..c54178c5 100644 --- a/jd_bean_sign.js +++ b/jd_bean_sign.js @@ -1,7 +1,7 @@ /* 京豆签到,自用,可N个京东账号,IOS软件用户请使用 https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js Node.JS专用 -更新时间:2020-12-21 +更新时间:2021-1-4 从 github @ruicky改写而来 version v0.0.1 create by ruicky @@ -17,6 +17,7 @@ const download = require('download'); let resultPath = "./result.txt"; let JD_DailyBonusPath = "./JD_DailyBonus.js"; let outPutUrl = './'; +let NodeSet = 'CookieSet.json'; let cookiesArr = [], cookie = ''; if ($.isNode()) { @@ -130,6 +131,7 @@ async function downFile () { async function changeFile (content) { console.log(`开始替换变量`) let newContent = content.replace(/var Key = ''/, `var Key = '${cookie}'`); + newContent = newContent.replace(/const NodeSet = 'CookieSet.json'/, `const NodeSet = ${NodeSet}`) if (process.env.JD_BEAN_STOP && process.env.JD_BEAN_STOP !== '0') { newContent = newContent.replace(/var stop = 0/, `var stop = ${process.env.JD_BEAN_STOP * 1}`); } @@ -219,6 +221,7 @@ function requireConfig() { resultPath = err ? '/tmp/result.txt' : resultPath; JD_DailyBonusPath = err ? '/tmp/JD_DailyBonus.js' : JD_DailyBonusPath; outPutUrl = err ? '/tmp/' : outPutUrl; + NodeSet = err ? '/tmp/CookieSet.json' : NodeSet; resolve() }); }) From ebfdf163a9bd2d4d4dcb0b849d3ff5999de718ac Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Mon, 4 Jan 2021 13:08:29 +0800 Subject: [PATCH 32/52] fix --- jd_bean_sign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jd_bean_sign.js b/jd_bean_sign.js index c54178c5..fb3fee0e 100644 --- a/jd_bean_sign.js +++ b/jd_bean_sign.js @@ -131,7 +131,7 @@ async function downFile () { async function changeFile (content) { console.log(`开始替换变量`) let newContent = content.replace(/var Key = ''/, `var Key = '${cookie}'`); - newContent = newContent.replace(/const NodeSet = 'CookieSet.json'/, `const NodeSet = ${NodeSet}`) + newContent = newContent.replace(/const NodeSet = 'CookieSet.json'/, `const NodeSet = '${NodeSet}'`) if (process.env.JD_BEAN_STOP && process.env.JD_BEAN_STOP !== '0') { newContent = newContent.replace(/var stop = 0/, `var stop = ${process.env.JD_BEAN_STOP * 1}`); } From 9436c180c6e13248a0ef95667d0e4234dab80d71 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Mon, 4 Jan 2021 13:47:35 +0800 Subject: [PATCH 33/52] debug --- jd_joy_reward.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jd_joy_reward.js b/jd_joy_reward.js index 26bf0c0f..560be572 100644 --- a/jd_joy_reward.js +++ b/jd_joy_reward.js @@ -299,7 +299,9 @@ function getJDServerTime() { }) } async function get_diff_time() { - // console.log(await getJDServerTime()) + console.log(`本机时间戳 ${Date.now()}`) + console.log(`京东服务器时间戳 ${await getJDServerTime()}`) + console.log(Date.now() - await getJDServerTime()) let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000; return nowTime - await getJDServerTime(); } From d98cfaa06a13dfe024e23befc0c236293ade4bb3 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Mon, 4 Jan 2021 13:51:16 +0800 Subject: [PATCH 34/52] debug --- jd_joy_reward.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jd_joy_reward.js b/jd_joy_reward.js index 560be572..2eaf482d 100644 --- a/jd_joy_reward.js +++ b/jd_joy_reward.js @@ -299,11 +299,9 @@ function getJDServerTime() { }) } async function get_diff_time() { - console.log(`本机时间戳 ${Date.now()}`) - console.log(`京东服务器时间戳 ${await getJDServerTime()}`) - console.log(Date.now() - await getJDServerTime()) - let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000; - return nowTime - await getJDServerTime(); + // console.log(`本机时间戳 ${Date.now()}`) + // console.log(`京东服务器时间戳 ${await getJDServerTime()}`) + return Date.now() - await getJDServerTime(); } function jsonParse(str) { if (typeof str == "string") { From 0245263814f71a6af3c2c90b76357cd16742ef42 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Mon, 4 Jan 2021 17:14:58 +0800 Subject: [PATCH 35/52] update --- jdCookie.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/jdCookie.js b/jdCookie.js index 4eb2bb76..8f30c693 100644 --- a/jdCookie.js +++ b/jdCookie.js @@ -15,17 +15,12 @@ if (process.env.JD_COOKIE) { } else if (process.env.JD_COOKIE.indexOf('\n') > -1) { console.log(`您的cookie选择的是用换行隔开\n`) CookieJDs = process.env.JD_COOKIE.split('\n'); - } else if (process.env.JD_COOKIE.indexOf('\\n') > -1) { - //环境变量兼容腾讯云和docker下\n会被转义成\\n - console.log(`您的cookie选择的是用换行隔开\\n`) - CookieJDs = process.env.JD_COOKIE.split('\\n'); } else { CookieJDs = [process.env.JD_COOKIE]; } CookieJDs = [...new Set(CookieJDs)] console.log(`\n====================共有${CookieJDs.length}个京东账号Cookie=========\n`); console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}=====================\n`) - // console.log(`\n==================脚本执行来自 github action=====================\n`) } for (let i = 0; i < CookieJDs.length; i++) { const index = (i + 1 === 1) ? '' : (i + 1); From 5a654ecbe17d44497fafba71fe79a40cc83e0f81 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Mon, 4 Jan 2021 17:22:19 +0800 Subject: [PATCH 36/52] update jdCookie.js --- jdCookie.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdCookie.js b/jdCookie.js index 8f30c693..f24b3983 100644 --- a/jdCookie.js +++ b/jdCookie.js @@ -18,10 +18,10 @@ if (process.env.JD_COOKIE) { } else { CookieJDs = [process.env.JD_COOKIE]; } - CookieJDs = [...new Set(CookieJDs)] - console.log(`\n====================共有${CookieJDs.length}个京东账号Cookie=========\n`); - console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}=====================\n`) } +CookieJDs = [...new Set(CookieJDs.filter(item => item !== "" && item !== null && item !== undefined))] +console.log(`\n====================共有${CookieJDs.length}个京东账号Cookie=========\n`); +console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}=====================\n`) for (let i = 0; i < CookieJDs.length; i++) { const index = (i + 1 === 1) ? '' : (i + 1); exports['CookieJD' + index] = CookieJDs[i]; From b1fed8b8e48e61e90097258a37b14c36ede7f996 Mon Sep 17 00:00:00 2001 From: sxx1314 <8444252+sxx1314@users.noreply.github.com> Date: Tue, 5 Jan 2021 00:53:50 +0800 Subject: [PATCH 37/52] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=20=E5=BA=94=E7=94=A8=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E4=B8=AD=E7=9A=84=E6=8D=A2=E8=A1=8C=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复企业微信 应用消息图文消息推送中换行缺失的问题 - 简单的替换了换行符,以后可以按照需求增加css等样式。 - 更换了图片id的issues说明链接 --- sendNotify.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sendNotify.js b/sendNotify.js index 262e5e97..e32a197b 100644 --- a/sendNotify.js +++ b/sendNotify.js @@ -49,7 +49,7 @@ let DD_BOT_SECRET = ''; let QYWX_KEY = ''; // =======================================企业微信应用消息通知设置区域=========================================== -//此处填你企业微信应用消息的 值(详见文档 https://work.weixin.qq.com/api/doc/90000/90135/90236),依次填上corpid的值,corpsecret的值,touser的值,agentid的值,素材库图片id(见https://work.weixin.qq.com/api/doc/90000/90135/90253) 注意用,号隔开,例如:wwcff56746d9adwers,B-791548lnzXBE6_BWfxdf3kSTMJr9vFEPKAbh6WERQ,mingcheng,1000001,2COXgjH2UIfERF2zxrtUOKgQ9XklUqMdGSWLBoW_lSDAdafat +//此处填你企业微信应用消息的 值(详见文档 https://work.weixin.qq.com/api/doc/90000/90135/90236),依次填上corpid的值,corpsecret的值,touser的值,agentid的值,素材库图片id(见https://github.com/lxk0301/jd_scripts/issues/519) 注意用,号隔开,例如:wwcff56746d9adwers,B-791548lnzXBE6_BWfxdf3kSTMJr9vFEPKAbh6WERQ,mingcheng,1000001,2COXgjH2UIfERF2zxrtUOKgQ9XklUqMdGSWLBoW_lSDAdafat //注:此处设置github action用户填写到Settings-Secrets里面(Name输入QYWX_AM) let QYWX_AM = ''; @@ -430,7 +430,8 @@ function qywxamNotify(text, desp) { 'Content-Type': 'application/json', }, }; - $.post(options_accesstoken, (err, resp, data) => { + $.post(options_accesstoken, (err, resp, data) => { + html=desp.replace(/\n/g,"
") var json = JSON.parse(data); accesstoken = json.access_token; const options = { @@ -446,7 +447,7 @@ function qywxamNotify(text, desp) { thumb_media_id: `${QYWX_AM_AY[4]}`, author : `智能助手` , content_source_url: ``, - content : `${desp}`, //暂时直接设置成了desp + content : `${html}`, digest: `${desp}` } ] From 84b20446ff993f2c139ed16f07d3ac4b83245fe5 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 09:20:26 +0800 Subject: [PATCH 38/52] update jdCookie.js --- jdCookie.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdCookie.js b/jdCookie.js index f24b3983..0dcadb23 100644 --- a/jdCookie.js +++ b/jdCookie.js @@ -24,5 +24,5 @@ console.log(`\n====================共有${CookieJDs.length}个京东账号Cooki console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}=====================\n`) for (let i = 0; i < CookieJDs.length; i++) { const index = (i + 1 === 1) ? '' : (i + 1); - exports['CookieJD' + index] = CookieJDs[i]; + exports['CookieJD' + index] = CookieJDs[i].trim(); } From 5d901f13aea09bf27b02fe38f19ad479b44a90aa Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 09:39:24 +0800 Subject: [PATCH 39/52] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=8C=E8=BF=81=E7=A7=BBtencentscf.md?= =?UTF-8?q?=E5=88=B0=E5=88=AB=E7=9A=84=E6=96=87=E4=BB=B6=E5=A4=B9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- jd_ds.js => activity/jd_ds.js | 0 backUp/tencentscf.md | 128 ++++++++++++++++++++++++++++++++++ jd_fruit.js | 40 ++++++----- 4 files changed, 152 insertions(+), 20 deletions(-) rename jd_ds.js => activity/jd_ds.js (100%) create mode 100644 backUp/tencentscf.md diff --git a/README.md b/README.md index 8783d737..005764d5 100644 --- a/README.md +++ b/README.md @@ -85,9 +85,9 @@ ### 方法二:云服务器、腾讯云函数等等 - 需自行有云服务器,云函数等 - - 腾讯云云函数 [快速部署教程](tencentscf.md)(免费) + - 腾讯云云函数 [快速部署教程](../tencentscf.md)(免费) - 腾讯云云函数控制台使用 [教程说明](iCloud.md) - - 腾讯云云函数 [GitHub Action部署教程](tencentscf.md#github-action-部署) + - 腾讯云云函数 [GitHub Action部署教程](../tencentscf.md#github-action-部署) ### 方法三:Docker(NAS或VPS用户) diff --git a/jd_ds.js b/activity/jd_ds.js similarity index 100% rename from jd_ds.js rename to activity/jd_ds.js diff --git a/backUp/tencentscf.md b/backUp/tencentscf.md new file mode 100644 index 00000000..30c04ca2 --- /dev/null +++ b/backUp/tencentscf.md @@ -0,0 +1,128 @@ + +# 云函数快速部署京东脚本 +> +> - 本地安装依赖使用serverless部署,[点这里](tencentscf.md#1-安装-nodejs-环境) +> - Github Action 部署[点这里](tencentscf.md#github-action-部署) + +## 1. 安装 Node.js 环境 + +Node.js 环境 [下载地址](https://nodejs.org/zh-tw/download/) ,根据自己的操作系统下载和安装。 + +## 2. 下载代码 + +点击红框处下载压缩包 +![下载代码](https://imgbed-bucket-1251971143.cos.ap-guangzhou.myqcloud.com/1605497672397-zip.png) + +## 3. 安装依赖,配置 cookie + +### 3.1 安装依赖 + +压缩包解压后进入项目文件夹 + +- Windows 用户按住 **shift** 点击右键,点击 **在此处打开命令窗口** +- Mac 用户通过终端,自行进入该文件夹 + +在命令行内输入 `npm i `,等待运行完成。 + +此时,项目文件夹内会多出一个 `node_modules`文件夹 + +### 3.2 配置 cookie + +打开项目文件内的 `jdCookie.js` + +在最上面的 `CookieJDs`里写入 cookie ,多个账号以逗号分隔 + +例如 + +```javascript +let CookieJDs = [ + 'pt_key=xxx;pt_pin=xxx;', + 'pt_key=zzz;pt_pin=zzz;', + 'pt_key=aaa;pt_pin=xxxaaa' +] +``` + +> 注:获取京东 cookie 教程参考 [浏览器获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie.md) , [插件获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie2.md) + + +## 4. 部署到云函数 + +### 4.1 开通服务 + +依次登录 [SCF 云函数控制台](https://console.cloud.tencent.com/scf) 和 [SLS 控制台](https://console.cloud.tencent.com/sls) 开通相关服务,确保账户下已开通服务并创建相应[服务角色](https://console.cloud.tencent.com/cam/role) **SCF_QcsRole、SLS_QcsRole** + +> 注意!为了确保权限足够,获取这两个参数时不要使用子账户!此外,腾讯云账户需要[实名认证](https://console.cloud.tencent.com/developer/auth)。 + +### 4.2 工具部署 + +下载 Serverless 工具,快速部署函数 +``` +npm install -g serverless +``` + +执行部署命令 +``` +serverless deploy +``` + +如果已经配置了永久秘钥,则可以直接部署,如果没有,可以直接**微信扫码**登录腾讯云,并且授权部署。 + +过几秒后,查看输出,可以看到函数和定时触发器都已经配置完成。 +``` +serverless ⚡framework +Action: "deploy" - Stage: "dev" - App: "jdscript" - Instance: "jdscript" + +functionName: scf-jdscript +description: This is a function in jdscript application. +namespace: default +runtime: Nodejs12.16 +handler: index.main_handler +memorySize: 64 +lastVersion: $LATEST +traffic: 1 +triggers: + timer: + - timer-jdscript-dev + +36s › jdscript › Success +``` + +## 5. 查看和测试 + +登录后,在 [腾讯云函数地址](https://console.cloud.tencent.com/scf/index) 点击管理控制台,查看最新部署的函数。 + +在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。 + +![测试函数](https://user-images.githubusercontent.com/6993269/99628053-5a9eea80-2a70-11eb-906f-f1d5ea2bfa3a.png) + +> 如果需要配置永久秘钥,则可以在[访问秘钥页面](https://console.cloud.tencent.com/cam/capi)获取账号的 TENCENT_SECRET_ID,TENCENT_SECRET_KEY,并配置在代码根目录 .env 文件中。 + + +# Github Action 部署 +## 1. 开通服务 + +依次登录 [SCF 云函数控制台](https://console.cloud.tencent.com/scf) 和 [SLS 控制台](https://console.cloud.tencent.com/sls) 开通相关服务,确保账户下已开通服务并创建相应[服务角色](https://console.cloud.tencent.com/cam/role) **SCF_QcsRole、SLS_QcsRole** + +> 注意!为了确保权限足够,获取这两个参数时不要使用子账户!此外,腾讯云账户需要[实名认证](https://console.cloud.tencent.com/developer/auth)。 + +## 2. 在这里新建一个访问密钥[新建密钥](https://console.cloud.tencent.com/cam/capi) +> 将SecretId和SecretKey分别配置在仓库的secrets变量里面, TENCENT_SECRET_ID对应你的SecretId的值,TENCENT_SECRET_KEY对应你的SecretKey的值 + +## 3. 配置自己需要secrets变量[参考这里](githubAction.md#下方提供使用到的-secrets全集合) +### __重要的说三遍__ +### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接 +### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接 +### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接 +> 排查问题第一步先看自己[腾讯云函数](https://console.cloud.tencent.com/scf/list-detail?rid=5&ns=default&id=scf-jdscript)那边的环境变量跟自己在仓库配置的 `secrets` 是否一致 +![image](https://user-images.githubusercontent.com/6993269/99937191-06617680-2da0-11eb-99ea-033f2c655683.png) + + +## 4.执行action workflow进行部署,workflow未报错即部署成功 +![image](https://user-images.githubusercontent.com/6993269/99513289-6a152980-29c5-11eb-9266-3f56ba13d3b2.png) +## 5. 查看和测试 +登录后,在 [腾讯云函数地址](https://console.cloud.tencent.com/scf/index) 点击管理控制台,查看最新部署的函数。 + +在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。 + +![测试函数](https://user-images.githubusercontent.com/6993269/99628053-5a9eea80-2a70-11eb-906f-f1d5ea2bfa3a.png) +## 6. 设置触发器[看这里](iCloud.md#5设置触发器) 或者看这里的[注释说明](https://github.com/iouAkira/jd_scripts/blob/patch-1/index.js#L4) diff --git a/jd_fruit.js b/jd_fruit.js index 2cb8ec94..327e97f3 100644 --- a/jd_fruit.js +++ b/jd_fruit.js @@ -1,6 +1,6 @@ /* 东东水果:脚本更新地址 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js -更新时间:2020-12-25 +更新时间:2021-1-5 东东农场活动链接:https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html 已支持IOS双京东账号,Node.js支持N个京东账号 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js @@ -29,9 +29,9 @@ let cookiesArr = [], cookie = '', jdFruitShareArr = [], isBox = false, notify, n //下面给出两个账号的填写示例(iOS只支持2个京东账号) let shareCodes = [ // 这个列表填入你要助力的好友的shareCode //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开 - '0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3@6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6@56db8e7bc5874668ba7d5195230d067a', + '0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3@6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6@56db8e7bc5874668ba7d5195230d067a@', //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开 - 'b1638a774d054a05a30a17d3b4d364b8@f92cb56c6a1349f5a35f0372aa041ea0@9c52670d52ad4e1a812f894563c746ea@8175509d82504e96828afc8b1bbb9cb3', + 'b1638a774d054a05a30a17d3b4d364b8@f92cb56c6a1349f5a35f0372aa041ea0@9c52670d52ad4e1a812f894563c746ea@8175509d82504e96828afc8b1bbb9cb3@2673c3777d4443829b2a635059953a28', ] let message = '', subTitle = '', option = {}, isFruitFinished = false; const retainWater = 100;//保留水滴大于多少g,默认100g; @@ -771,24 +771,28 @@ async function clockInIn() { // async function getAwardInviteFriend() { await friendListInitForFarm();//查询好友列表 - console.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}个`); - console.log(`开始删除${$.friendList.friends.length}个好友,可拿每天的邀请奖励`); - for (let friend of $.friendList.friends) { - console.log(`\n开始删除好友 [${friend.shareCode}]`); - const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 }); - if (deleteFriendForFarm && deleteFriendForFarm.code === '0') { - console.log(`删除好友 [${friend.shareCode}] 成功\n`); + if ($.friendList) { + console.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}个`); + console.log(`开始删除${$.friendList.friends.length}个好友,可拿每天的邀请奖励`); + for (let friend of $.friendList.friends) { + console.log(`\n开始删除好友 [${friend.shareCode}]`); + const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 }); + if (deleteFriendForFarm && deleteFriendForFarm.code === '0') { + console.log(`删除好友 [${friend.shareCode}] 成功\n`); + } } - } - await receiveFriendInvite();//为他人助力,接受邀请成为别人的好友 - if ($.friendList.inviteFriendCount > 0) { - if ($.friendList.inviteFriendCount > $.friendList.inviteFriendGotAwardCount) { - console.log('开始领取邀请好友的奖励'); - await awardInviteFriendForFarm(); - console.log(`领取邀请好友的奖励结果::${JSON.stringify($.awardInviteFriendRes)}`); + await receiveFriendInvite();//为他人助力,接受邀请成为别人的好友 + if ($.friendList.inviteFriendCount > 0) { + if ($.friendList.inviteFriendCount > $.friendList.inviteFriendGotAwardCount) { + console.log('开始领取邀请好友的奖励'); + await awardInviteFriendForFarm(); + console.log(`领取邀请好友的奖励结果::${JSON.stringify($.awardInviteFriendRes)}`); + } + } else { + console.log('今日未邀请过好友') } } else { - console.log('今日未邀请过好友') + console.log(`查询好友列表失败\n`); } } //给好友浇水 From 91cafec2b0a7fcc661d5fb601bdd2d964dcc14ef Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 09:41:24 +0800 Subject: [PATCH 40/52] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 005764d5..4290e747 100644 --- a/README.md +++ b/README.md @@ -85,9 +85,9 @@ ### 方法二:云服务器、腾讯云函数等等 - 需自行有云服务器,云函数等 - - 腾讯云云函数 [快速部署教程](../tencentscf.md)(免费) + - 腾讯云云函数 [快速部署教程](./backUp/tencentscf.md)(免费) - 腾讯云云函数控制台使用 [教程说明](iCloud.md) - - 腾讯云云函数 [GitHub Action部署教程](../tencentscf.md#github-action-部署) + - 腾讯云云函数 [GitHub Action部署教程](./backUp/tencentscf.md#github-action-部署) ### 方法三:Docker(NAS或VPS用户) From b136ad66365a45694af6948bbe9092f4a63a04fe Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 10:00:14 +0800 Subject: [PATCH 41/52] update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4290e747..5c424359 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ ### 方法四:iOS系统的代理软件(QuantumultX, Surge, Loon, 小火箭) -#### [京东cookie获取脚本](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/JD_extra_cookie.js) + - [京东cookie获取脚本 JD_extra_cookie.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/JD_extra_cookie.js) ### 赞赏码(开发维护不易,请赏杯茶水费)
From 407bd635452ccb205f6dfd93547089cc3374b206 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 10:05:56 +0800 Subject: [PATCH 42/52] =?UTF-8?q?=E8=BF=81=E7=A7=BB=20iCloud.md=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- iCloud.md => backUp/iCloud.md | 10 +++++----- backUp/tencentscf.md | 2 +- tencentscf.md | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) rename iCloud.md => backUp/iCloud.md (98%) diff --git a/README.md b/README.md index 5c424359..682c55cb 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ - 需自行有云服务器,云函数等 - 腾讯云云函数 [快速部署教程](./backUp/tencentscf.md)(免费) - - 腾讯云云函数控制台使用 [教程说明](iCloud.md) + - 腾讯云云函数控制台使用 [教程说明](./backUp/iCloud.md) - 腾讯云云函数 [GitHub Action部署教程](./backUp/tencentscf.md#github-action-部署) diff --git a/iCloud.md b/backUp/iCloud.md similarity index 98% rename from iCloud.md rename to backUp/iCloud.md index 9eb86134..22696205 100644 --- a/iCloud.md +++ b/backUp/iCloud.md @@ -108,21 +108,21 @@ let CookieJDs = [ 单击左侧导航栏**函数服务**,进入“函数服务”页面。 在页面上方选择一个地域,最好选择离你常用地区近点的,不至于导致账号异常。单击**新建**。如下图所示: -![iCloud1](./icon/iCloud1.png) +![iCloud1](../icon/iCloud1.png) 在“新建函数”页面填写函数基础信息,单击**下一步**。如下图所示: -![iCloud2](./icon/iCloud2.png) +![iCloud2](../icon/iCloud2.png) **函数名称**:可以自定义,比如为jd。
**运行环境**:选择 “Nodejs 12.16”。
**创建方式**:选择 “空白函数”。 确保环境为Nodejs 12.16,执行方法改为:index.main_handler,提交方式建议选本地文件夹,然后从GitHub项目克隆Zip压缩包,解压成文件夹,然后点击这个上传把文件夹上传进来(记得node_modules文件夹一并上传或者将node_modules文件夹上传到“层”,之后选择“函数管理”-“层管理”绑定上传好的层),完了后点击下面的高级设置。 -![iCloud3](./icon/iCloud3.png) +![iCloud3](../icon/iCloud3.png) 内存用不了太大,64MB就够了(64M内存,免费时长6,400,000秒,内存与免费时长大致关系可以参看云函数官方说明),超时时间改为最大的900秒,然后点击最下面的完成。 -![iCloud4](./icon/iCloud4.png) +![iCloud4](../icon/iCloud4.png) ## 5.设置触发器 @@ -136,7 +136,7 @@ let CookieJDs = [ 创建触发器 -![iCloud6](./icon/iCloud6.png) +![iCloud6](../icon/iCloud6.png) 触发方式默认“**定时触发**”,定时任务名称随便起个名字,触发周期根据自己需要自行设置。 diff --git a/backUp/tencentscf.md b/backUp/tencentscf.md index 30c04ca2..eb31e499 100644 --- a/backUp/tencentscf.md +++ b/backUp/tencentscf.md @@ -125,4 +125,4 @@ triggers: 在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。 ![测试函数](https://user-images.githubusercontent.com/6993269/99628053-5a9eea80-2a70-11eb-906f-f1d5ea2bfa3a.png) -## 6. 设置触发器[看这里](iCloud.md#5设置触发器) 或者看这里的[注释说明](https://github.com/iouAkira/jd_scripts/blob/patch-1/index.js#L4) +## 6. 设置触发器[看这里](./backUp/iCloud.md#5设置触发器) 或者看这里的[注释说明](https://github.com/iouAkira/jd_scripts/blob/patch-1/index.js#L4) diff --git a/tencentscf.md b/tencentscf.md index 30c04ca2..eb31e499 100644 --- a/tencentscf.md +++ b/tencentscf.md @@ -125,4 +125,4 @@ triggers: 在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。 ![测试函数](https://user-images.githubusercontent.com/6993269/99628053-5a9eea80-2a70-11eb-906f-f1d5ea2bfa3a.png) -## 6. 设置触发器[看这里](iCloud.md#5设置触发器) 或者看这里的[注释说明](https://github.com/iouAkira/jd_scripts/blob/patch-1/index.js#L4) +## 6. 设置触发器[看这里](./backUp/iCloud.md#5设置触发器) 或者看这里的[注释说明](https://github.com/iouAkira/jd_scripts/blob/patch-1/index.js#L4) From 910031270a951c074f5c6d9da16c07ab5c613b13 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 10:08:18 +0800 Subject: [PATCH 43/52] fix --- backUp/tencentscf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backUp/tencentscf.md b/backUp/tencentscf.md index eb31e499..30c04ca2 100644 --- a/backUp/tencentscf.md +++ b/backUp/tencentscf.md @@ -125,4 +125,4 @@ triggers: 在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。 ![测试函数](https://user-images.githubusercontent.com/6993269/99628053-5a9eea80-2a70-11eb-906f-f1d5ea2bfa3a.png) -## 6. 设置触发器[看这里](./backUp/iCloud.md#5设置触发器) 或者看这里的[注释说明](https://github.com/iouAkira/jd_scripts/blob/patch-1/index.js#L4) +## 6. 设置触发器[看这里](iCloud.md#5设置触发器) 或者看这里的[注释说明](https://github.com/iouAkira/jd_scripts/blob/patch-1/index.js#L4) From 50118f917d8285a7fd3c35ae0de2bcfef5d19f9f Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 10:27:22 +0800 Subject: [PATCH 44/52] delete --- tencentscf.md | 128 -------------------------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 tencentscf.md diff --git a/tencentscf.md b/tencentscf.md deleted file mode 100644 index eb31e499..00000000 --- a/tencentscf.md +++ /dev/null @@ -1,128 +0,0 @@ - -# 云函数快速部署京东脚本 -> -> - 本地安装依赖使用serverless部署,[点这里](tencentscf.md#1-安装-nodejs-环境) -> - Github Action 部署[点这里](tencentscf.md#github-action-部署) - -## 1. 安装 Node.js 环境 - -Node.js 环境 [下载地址](https://nodejs.org/zh-tw/download/) ,根据自己的操作系统下载和安装。 - -## 2. 下载代码 - -点击红框处下载压缩包 -![下载代码](https://imgbed-bucket-1251971143.cos.ap-guangzhou.myqcloud.com/1605497672397-zip.png) - -## 3. 安装依赖,配置 cookie - -### 3.1 安装依赖 - -压缩包解压后进入项目文件夹 - -- Windows 用户按住 **shift** 点击右键,点击 **在此处打开命令窗口** -- Mac 用户通过终端,自行进入该文件夹 - -在命令行内输入 `npm i `,等待运行完成。 - -此时,项目文件夹内会多出一个 `node_modules`文件夹 - -### 3.2 配置 cookie - -打开项目文件内的 `jdCookie.js` - -在最上面的 `CookieJDs`里写入 cookie ,多个账号以逗号分隔 - -例如 - -```javascript -let CookieJDs = [ - 'pt_key=xxx;pt_pin=xxx;', - 'pt_key=zzz;pt_pin=zzz;', - 'pt_key=aaa;pt_pin=xxxaaa' -] -``` - -> 注:获取京东 cookie 教程参考 [浏览器获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie.md) , [插件获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie2.md) - - -## 4. 部署到云函数 - -### 4.1 开通服务 - -依次登录 [SCF 云函数控制台](https://console.cloud.tencent.com/scf) 和 [SLS 控制台](https://console.cloud.tencent.com/sls) 开通相关服务,确保账户下已开通服务并创建相应[服务角色](https://console.cloud.tencent.com/cam/role) **SCF_QcsRole、SLS_QcsRole** - -> 注意!为了确保权限足够,获取这两个参数时不要使用子账户!此外,腾讯云账户需要[实名认证](https://console.cloud.tencent.com/developer/auth)。 - -### 4.2 工具部署 - -下载 Serverless 工具,快速部署函数 -``` -npm install -g serverless -``` - -执行部署命令 -``` -serverless deploy -``` - -如果已经配置了永久秘钥,则可以直接部署,如果没有,可以直接**微信扫码**登录腾讯云,并且授权部署。 - -过几秒后,查看输出,可以看到函数和定时触发器都已经配置完成。 -``` -serverless ⚡framework -Action: "deploy" - Stage: "dev" - App: "jdscript" - Instance: "jdscript" - -functionName: scf-jdscript -description: This is a function in jdscript application. -namespace: default -runtime: Nodejs12.16 -handler: index.main_handler -memorySize: 64 -lastVersion: $LATEST -traffic: 1 -triggers: - timer: - - timer-jdscript-dev - -36s › jdscript › Success -``` - -## 5. 查看和测试 - -登录后,在 [腾讯云函数地址](https://console.cloud.tencent.com/scf/index) 点击管理控制台,查看最新部署的函数。 - -在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。 - -![测试函数](https://user-images.githubusercontent.com/6993269/99628053-5a9eea80-2a70-11eb-906f-f1d5ea2bfa3a.png) - -> 如果需要配置永久秘钥,则可以在[访问秘钥页面](https://console.cloud.tencent.com/cam/capi)获取账号的 TENCENT_SECRET_ID,TENCENT_SECRET_KEY,并配置在代码根目录 .env 文件中。 - - -# Github Action 部署 -## 1. 开通服务 - -依次登录 [SCF 云函数控制台](https://console.cloud.tencent.com/scf) 和 [SLS 控制台](https://console.cloud.tencent.com/sls) 开通相关服务,确保账户下已开通服务并创建相应[服务角色](https://console.cloud.tencent.com/cam/role) **SCF_QcsRole、SLS_QcsRole** - -> 注意!为了确保权限足够,获取这两个参数时不要使用子账户!此外,腾讯云账户需要[实名认证](https://console.cloud.tencent.com/developer/auth)。 - -## 2. 在这里新建一个访问密钥[新建密钥](https://console.cloud.tencent.com/cam/capi) -> 将SecretId和SecretKey分别配置在仓库的secrets变量里面, TENCENT_SECRET_ID对应你的SecretId的值,TENCENT_SECRET_KEY对应你的SecretKey的值 - -## 3. 配置自己需要secrets变量[参考这里](githubAction.md#下方提供使用到的-secrets全集合) -### __重要的说三遍__ -### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接 -### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接 -### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接 -> 排查问题第一步先看自己[腾讯云函数](https://console.cloud.tencent.com/scf/list-detail?rid=5&ns=default&id=scf-jdscript)那边的环境变量跟自己在仓库配置的 `secrets` 是否一致 -![image](https://user-images.githubusercontent.com/6993269/99937191-06617680-2da0-11eb-99ea-033f2c655683.png) - - -## 4.执行action workflow进行部署,workflow未报错即部署成功 -![image](https://user-images.githubusercontent.com/6993269/99513289-6a152980-29c5-11eb-9266-3f56ba13d3b2.png) -## 5. 查看和测试 -登录后,在 [腾讯云函数地址](https://console.cloud.tencent.com/scf/index) 点击管理控制台,查看最新部署的函数。 - -在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。 - -![测试函数](https://user-images.githubusercontent.com/6993269/99628053-5a9eea80-2a70-11eb-906f-f1d5ea2bfa3a.png) -## 6. 设置触发器[看这里](./backUp/iCloud.md#5设置触发器) 或者看这里的[注释说明](https://github.com/iouAkira/jd_scripts/blob/patch-1/index.js#L4) From 832245840c4b441c35af2344890c46647dc3f62d Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 12:44:30 +0800 Subject: [PATCH 45/52] =?UTF-8?q?=E4=B8=9C=E4=B8=9C=E5=86=9C=E5=9C=BA?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0log=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_fruit.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/jd_fruit.js b/jd_fruit.js index 327e97f3..0b4b3ba2 100644 --- a/jd_fruit.js +++ b/jd_fruit.js @@ -771,14 +771,17 @@ async function clockInIn() { // async function getAwardInviteFriend() { await friendListInitForFarm();//查询好友列表 + console.log(`查询好友列表数据:${JSON.stringify($.friendList)}\n`) if ($.friendList) { console.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}个`); - console.log(`开始删除${$.friendList.friends.length}个好友,可拿每天的邀请奖励`); - for (let friend of $.friendList.friends) { - console.log(`\n开始删除好友 [${friend.shareCode}]`); - const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 }); - if (deleteFriendForFarm && deleteFriendForFarm.code === '0') { - console.log(`删除好友 [${friend.shareCode}] 成功\n`); + console.log(`开始删除${$.friendList.friends && $.friendList.friends.length}个好友,可拿每天的邀请奖励`); + if ($.friendList.friends && $.friendList.friends.length > 0) { + for (let friend of $.friendList.friends) { + console.log(`\n开始删除好友 [${friend.shareCode}]`); + const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 }); + if (deleteFriendForFarm && deleteFriendForFarm.code === '0') { + console.log(`删除好友 [${friend.shareCode}] 成功\n`); + } } } await receiveFriendInvite();//为他人助力,接受邀请成为别人的好友 From 98381caec3e7c95b0cfee948e743b29873d842f0 Mon Sep 17 00:00:00 2001 From: anonymous Date: Tue, 5 Jan 2021 13:23:34 +0800 Subject: [PATCH 46/52] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=8A=A9=E5=8A=9B=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_get_share_code.js | 626 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 626 insertions(+) create mode 100644 jd_get_share_code.js diff --git a/jd_get_share_code.js b/jd_get_share_code.js new file mode 100644 index 00000000..46357d5b --- /dev/null +++ b/jd_get_share_code.js @@ -0,0 +1,626 @@ +const $ = new Env("获取互助码"); +const JD_API_HOST = "https://api.m.jd.com/client.action"; +let cookiesArr = [], cookie = '', message; +const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; +!function (n) { + "use strict"; + + function t(n, t) { + var r = (65535 & n) + (65535 & t); + return (n >> 16) + (t >> 16) + (r >> 16) << 16 | 65535 & r + } + + function r(n, t) { + return n << t | n >>> 32 - t + } + + function e(n, e, o, u, c, f) { + return t(r(t(t(e, n), t(u, f)), c), o) + } + + function o(n, t, r, o, u, c, f) { + return e(t & r | ~t & o, n, t, u, c, f) + } + + function u(n, t, r, o, u, c, f) { + return e(t & o | r & ~o, n, t, u, c, f) + } + + function c(n, t, r, o, u, c, f) { + return e(t ^ r ^ o, n, t, u, c, f) + } + + function f(n, t, r, o, u, c, f) { + return e(r ^ (t | ~o), n, t, u, c, f) + } + + function i(n, r) { + n[r >> 5] |= 128 << r % 32, + n[14 + (r + 64 >>> 9 << 4)] = r; + var e, i, a, d, h, l = 1732584193, g = -271733879, v = -1732584194, m = 271733878; + for (e = 0; e < n.length; e += 16) + i = l, + a = g, + d = v, + h = m, + g = f(g = f(g = f(g = f(g = c(g = c(g = c(g = c(g = u(g = u(g = u(g = u(g = o(g = o(g = o(g = o(g, v = o(v, m = o(m, l = o(l, g, v, m, n[e], 7, -680876936), g, v, n[e + 1], 12, -389564586), l, g, n[e + 2], 17, 606105819), m, l, n[e + 3], 22, -1044525330), v = o(v, m = o(m, l = o(l, g, v, m, n[e + 4], 7, -176418897), g, v, n[e + 5], 12, 1200080426), l, g, n[e + 6], 17, -1473231341), m, l, n[e + 7], 22, -45705983), v = o(v, m = o(m, l = o(l, g, v, m, n[e + 8], 7, 1770035416), g, v, n[e + 9], 12, -1958414417), l, g, n[e + 10], 17, -42063), m, l, n[e + 11], 22, -1990404162), v = o(v, m = o(m, l = o(l, g, v, m, n[e + 12], 7, 1804603682), g, v, n[e + 13], 12, -40341101), l, g, n[e + 14], 17, -1502002290), m, l, n[e + 15], 22, 1236535329), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 1], 5, -165796510), g, v, n[e + 6], 9, -1069501632), l, g, n[e + 11], 14, 643717713), m, l, n[e], 20, -373897302), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 5], 5, -701558691), g, v, n[e + 10], 9, 38016083), l, g, n[e + 15], 14, -660478335), m, l, n[e + 4], 20, -405537848), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 9], 5, 568446438), g, v, n[e + 14], 9, -1019803690), l, g, n[e + 3], 14, -187363961), m, l, n[e + 8], 20, 1163531501), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 13], 5, -1444681467), g, v, n[e + 2], 9, -51403784), l, g, n[e + 7], 14, 1735328473), m, l, n[e + 12], 20, -1926607734), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 5], 4, -378558), g, v, n[e + 8], 11, -2022574463), l, g, n[e + 11], 16, 1839030562), m, l, n[e + 14], 23, -35309556), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 1], 4, -1530992060), g, v, n[e + 4], 11, 1272893353), l, g, n[e + 7], 16, -155497632), m, l, n[e + 10], 23, -1094730640), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 13], 4, 681279174), g, v, n[e], 11, -358537222), l, g, n[e + 3], 16, -722521979), m, l, n[e + 6], 23, 76029189), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 9], 4, -640364487), g, v, n[e + 12], 11, -421815835), l, g, n[e + 15], 16, 530742520), m, l, n[e + 2], 23, -995338651), v = f(v, m = f(m, l = f(l, g, v, m, n[e], 6, -198630844), g, v, n[e + 7], 10, 1126891415), l, g, n[e + 14], 15, -1416354905), m, l, n[e + 5], 21, -57434055), v = f(v, m = f(m, l = f(l, g, v, m, n[e + 12], 6, 1700485571), g, v, n[e + 3], 10, -1894986606), l, g, n[e + 10], 15, -1051523), m, l, n[e + 1], 21, -2054922799), v = f(v, m = f(m, l = f(l, g, v, m, n[e + 8], 6, 1873313359), g, v, n[e + 15], 10, -30611744), l, g, n[e + 6], 15, -1560198380), m, l, n[e + 13], 21, 1309151649), v = f(v, m = f(m, l = f(l, g, v, m, n[e + 4], 6, -145523070), g, v, n[e + 11], 10, -1120210379), l, g, n[e + 2], 15, 718787259), m, l, n[e + 9], 21, -343485551), + l = t(l, i), + g = t(g, a), + v = t(v, d), + m = t(m, h); + return [l, g, v, m] + } + + function a(n) { + var t, r = "", e = 32 * n.length; + for (t = 0; t < e; t += 8) + r += String.fromCharCode(n[t >> 5] >>> t % 32 & 255); + return r + } + + function d(n) { + var t, r = []; + for (r[(n.length >> 2) - 1] = void 0, + t = 0; t < r.length; t += 1) + r[t] = 0; + var e = 8 * n.length; + for (t = 0; t < e; t += 8) + r[t >> 5] |= (255 & n.charCodeAt(t / 8)) << t % 32; + return r + } + + function h(n) { + return a(i(d(n), 8 * n.length)) + } + + function l(n, t) { + var r, e, o = d(n), u = [], c = []; + for (u[15] = c[15] = void 0, + o.length > 16 && (o = i(o, 8 * n.length)), + r = 0; r < 16; r += 1) + u[r] = 909522486 ^ o[r], + c[r] = 1549556828 ^ o[r]; + return e = i(u.concat(d(t)), 512 + 8 * t.length), + a(i(c.concat(e), 640)) + } + + function g(n) { + var t, r, e = ""; + for (r = 0; r < n.length; r += 1) + t = n.charCodeAt(r), + e += "0123456789abcdef".charAt(t >>> 4 & 15) + "0123456789abcdef".charAt(15 & t); + return e + } + + function v(n) { + return unescape(encodeURIComponent(n)) + } + + function m(n) { + return h(v(n)) + } + + function p(n) { + return g(m(n)) + } + + function s(n, t) { + return l(v(n), v(t)) + } + + function C(n, t) { + return g(s(n, t)) + } + + function A(n, t, r) { + return t ? r ? s(t, n) : C(t, n) : r ? m(n) : p(n) + } + + $.md5 = A +}(this); +if ($.isNode()) { + Object.keys(jdCookieNode).forEach((item) => { + cookiesArr.push(jdCookieNode[item]) + }) + if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; +} else { + let cookiesData = $.getdata('CookiesJD') || "[]"; + cookiesData = jsonParse(cookiesData); + cookiesArr = cookiesData.map(item => item.cookie); + cookiesArr.reverse(); + cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]); + cookiesArr.reverse(); +} +!(async () => { + if (!cookiesArr[0]) { + $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + return; + } + for (let i = 0; i < cookiesArr.length; i++) { + if (cookiesArr[i]) { + cookie = cookiesArr[i]; + $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]) + $.index = i + 1; + $.isLogin = true; + $.nickName = ''; + message = ''; + console.log(`======账号${$.index}开始======`) + await getShareCode() + console.log(`======账号${$.index}结束======`) + } + + } +})() + .catch((e) => { + $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') + }) + .finally(() => { + $.done(); + }) +function getJdFactory() { + return new Promise(resolve => { + $.post( + taskPostUrl("jdfactory_getTaskDetail", {}, "jdfactory_getTaskDetail"), + async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`); + console.log(`$东东工厂 API请求失败,请检查网路重试`); + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data.data.bizCode === 0) { + $.taskVos = data.data.result.taskVos; //任务列表 + $.taskVos.map((item) => { + if (item.taskType === 14) { + console.log( + `【东东工厂】${item.assistTaskDetailVo.taskToken}` + ); + } + }); + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + } + ); + }) +} +function getJxFactory(){ + const JX_API_HOST = "https://m.jingxi.com"; + + function JXGC_taskurl(functionId, body = "") { + return { + url: `${JX_API_HOST}/dreamfactory/${functionId}?zone=dream_factory&${body}&sceneval=2&g_login_type=1&_time=${Date.now()}&_=${Date.now()}`, + headers: { + Cookie: cookie, + Host: "m.jingxi.com", + Accept: "*/*", + Connection: "keep-alive", + "User-Agent": + "jdpingou;iPhone;3.14.4;14.0;ae75259f6ca8378672006fc41079cd8c90c53be8;network/wifi;model/iPhone10,2;appBuild/100351;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/1;hasOCPay/0;supportBestPay/0;session/62;pap/JA2015_311210;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", + "Accept-Language": "zh-cn", + Referer: "https://wqsd.jd.com/pingou/dream_factory/index.html", + "Accept-Encoding": "gzip, deflate, br", + }, + }; + } + + return new Promise(resolve => { + $.get( + JXGC_taskurl( + "userinfo/GetUserInfo", + `pin=&sharePin=&shareType=&materialTuanPin=&materialTuanId=` + ), + async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`); + console.log(`惊喜工厂 API请求失败,请检查网路重试`); + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data["ret"] === 0) { + data = data["data"]; + $.unActive = true; //标记是否开启了京喜活动或者选购了商品进行生产 + $.encryptPin = ""; + $.shelvesList = []; + if (data.factoryList && data.productionList) { + const production = data.productionList[0]; + const factory = data.factoryList[0]; + const productionStage = data.productionStage; + $.factoryId = factory.factoryId; //工厂ID + $.productionId = production.productionId; //商品ID + $.commodityDimId = production.commodityDimId; + $.encryptPin = data.user.encryptPin; + // subTitle = data.user.pin; + console.log(`【惊喜工厂】${data.user.encryptPin}`); + } + } else { + $.unActive = false; //标记是否开启了京喜活动或者选购了商品进行生产 + if (!data.factoryList) { + console.log( + `【提示】京东账号${$.index}[${$.nickName}]京喜工厂活动未开始请手动去京东APP->游戏与互动->查看更多->京喜工厂 开启活动` + ); + } else if (data.factoryList && !data.productionList) { + console.log( + `【提示】京东账号${$.index}[${$.nickName}]京喜工厂未选购商品请手动去京东APP->游戏与互动->查看更多->京喜工厂 选购` + ); + } + } + } else { + console.log(`GetUserInfo异常:${JSON.stringify(data)}`); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + } + ); + }) +} +function getJdPet(){ + const JDPet_API_HOST = "https://api.m.jd.com/client.action"; + + function jdPet_Url(function_id, body = {}) { + body["version"] = 2; + body["channel"] = "app"; + return { + url: `${JDPet_API_HOST}?functionId=${function_id}`, + body: `body=${escape( + JSON.stringify(body) + )}&appid=wh5&loginWQBiz=pet-town&clientVersion=9.0.4`, + headers: { + Cookie: cookie, + "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", + Host: "api.m.jd.com", + "Content-Type": "application/x-www-form-urlencoded", + }, + }; + } + return new Promise(resolve => { + $.post(jdPet_Url("initPetTown"), async (err, resp, data) => { + try { + if (err) { + console.log("东东萌宠: API查询请求失败 ‼️‼️"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + data = JSON.parse(data); + + const initPetTownRes = data; + + message = `【京东账号${$.index}】${$.nickName}`; + if ( + initPetTownRes.code === "0" && + initPetTownRes.resultCode === "0" && + initPetTownRes.message === "success" + ) { + $.petInfo = initPetTownRes.result; + if ($.petInfo.userStatus === 0) { + /*console.log( + `【提示】京东账号${$.index}${$.nickName}萌宠活动未开启请手动去京东APP开启活动入口:我的->游戏与互动->查看更多开启` + );*/ + return; + } + + console.log( + `【京东萌宠】${$.petInfo.shareCode}` + ); + + } else if (initPetTownRes.code === "0") { + console.log(`初始化萌宠失败: ${initPetTownRes.message}`); + } else { + console.log("shit"); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(data); + } + }); + }) +} +async function getJdZZ() { + const JDZZ_API_HOST = "https://api.m.jd.com/client.action"; + + function getUserInfo() { + return new Promise(resolve => { + $.get(taskZZUrl("interactIndex"), 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.data.shareTaskRes) { + console.log(`【京东赚赚】${data.data.shareTaskRes.itemId}`); + } else { + //console.log(`已满5人助力,暂时看不到您的京东赚赚好友助力码`) + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(data); + } + }) + }) + } + + function taskZZUrl(functionId, body = {}) { + return { + url: `${JDZZ_API_HOST}?functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=9.1.0`, + headers: { + 'Cookie': cookie, + 'Host': 'api.m.jd.com', + 'Connection': 'keep-alive', + 'Content-Type': 'application/json', + 'Referer': 'http://wq.jd.com/wxapp/pages/hd-interaction/index/index', + '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"), + 'Accept-Language': 'zh-cn', + 'Accept-Encoding': 'gzip, deflate, br', + } + } + } + + await getUserInfo() +} +async function getPlantBean() { + const JDplant_API_HOST = "https://api.m.jd.com/client.action"; + + async function plantBeanIndex() { + $.plantBeanIndexResult = await plant_request("plantBeanIndex"); //plantBeanIndexBody + } + + function plant_request(function_id, body = {}) { + return new Promise(async (resolve) => { + $.post(plant_taskUrl(function_id, body), (err, resp, data) => { + try { + if (err) { + console.log("种豆得豆: API查询请求失败 ‼️‼️"); + console.log(`function_id:${function_id}`); + $.logErr(err); + } else { + data = JSON.parse(data); + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(data); + } + }); + }); + } + + function plant_taskUrl(function_id, body) { + body["version"] = "9.0.0.1"; + body["monitor_source"] = "plant_app_plant_index"; + body["monitor_refer"] = ""; + return { + url: JDplant_API_HOST, + body: `functionId=${function_id}&body=${escape( + JSON.stringify(body) + )}&appid=ld&client=apple&area=5_274_49707_49973&build=167283&clientVersion=9.1.0`, + headers: { + Cookie: cookie, + Host: "api.m.jd.com", + Accept: "*/*", + Connection: "keep-alive", + "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", + "Accept-Language": "zh-Hans-CN;q=1,en-CN;q=0.9", + "Accept-Encoding": "gzip, deflate, br", + "Content-Type": "application/x-www-form-urlencoded", + }, + }; + } + + function getParam(url, name) { + const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); + const r = url.match(reg); + if (r != null) return unescape(r[2]); + return null; + } + + async function jdPlantBean() { + await plantBeanIndex(); + // console.log(plantBeanIndexResult.data.taskList); + if ($.plantBeanIndexResult.code === "0") { + const shareUrl = $.plantBeanIndexResult.data.jwordShareInfo.shareUrl; + $.myPlantUuid = getParam(shareUrl, "plantUuid"); + console.log(`【种豆得豆】${$.myPlantUuid}`); + + } else { + console.log( + `种豆得豆-初始失败: ${JSON.stringify($.plantBeanIndexResult)}` + ); + } + } + + await jdPlantBean(); +} +async function getJDFruit() { + async function initForFarm() { + return new Promise((resolve) => { + const option = { + url: `${JD_API_HOST}?functionId=initForFarm`, + body: `body=${escape( + JSON.stringify({version: 4}) + )}&appid=wh5&clientVersion=9.1.0`, + headers: { + accept: "*/*", + "accept-encoding": "gzip, deflate, br", + "accept-language": "zh-CN,zh;q=0.9", + "cache-control": "no-cache", + cookie: cookie, + origin: "https://home.m.jd.com", + pragma: "no-cache", + referer: "https://home.m.jd.com/myJd/newhome.action", + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "same-site", + "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", + "Content-Type": "application/x-www-form-urlencoded", + }, + }; + $.post(option, (err, resp, data) => { + try { + if (err) { + console.log("东东农场: API查询请求失败 ‼️‼️"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + $.farmInfo = JSON.parse(data); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); + } + + async function jdFruit() { + await initForFarm(); + if ($.farmInfo.farmUserPro) { + // option['media-url'] = $.farmInfo.farmUserPro.goodsImage; + subTitle = `【京东账号${$.index}】${$.nickName}`; + message = `【水果名称】${$.farmInfo.farmUserPro.name}`; + console.log( + `【京东农场】${$.farmInfo.farmUserPro.shareCode}` + ); + + } else { + /*console.log( + `初始化农场数据异常, 请登录京东 app查看农场0元水果功能是否正常,农场初始化数据: ${JSON.stringify( + $.farmInfo + )}` + );*/ + } + } + + await jdFruit(); +} +async function getJoy(){ + function taskUrl(functionId, body = '') { + let t = Date.now().toString().substr(0, 10) + let e = body || "" + e = $.md5("aDvScBv$gGQvrXfva8dG!ZC@DA70Y%lX" + e + t) + e = e + Number(t).toString(16) + return { + url: `${JD_API_HOST}?uts=${e}&appid=crazy_joy&functionId=${functionId}&body=${escape(body)}&t=${t}`, + headers: { + 'Cookie': cookie, + 'Host': 'api.m.jd.com', + 'Accept': '*/*', + 'Connection': 'keep-alive', + "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"), + 'Accept-Language': 'zh-cn', + 'Referer': 'https://crazy-joy.jd.com/', + 'origin': 'https://crazy-joy.jd.com', + 'Accept-Encoding': 'gzip, deflate, br', + } + } + } + let body = {"paramData": {}} + return new Promise(async resolve => { + $.get(taskUrl('crazyJoy_user_gameState', JSON.stringify(body)), 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.success && data.data && data.data.userInviteCode) { + console.log(`【crazyJoy】${data.data.userInviteCode}`) + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +async function getShareCode() { + await getJdFactory() + await getJxFactory() + await getJdPet() + await getPlantBean() + await getJDFruit() + await getJdZZ() + await getJoy() +} + +function safeGet(data) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } + } catch (e) { + console.log(e); + console.log(`京东服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function taskPostUrl(function_id, body = {}, function_id2) { + let url = `${JD_API_HOST}`; + if (function_id2) { + url += `?functionId=${function_id2}`; + } + return { + url, + body: `functionId=${function_id}&body=${escape( + JSON.stringify(body) + )}&client=wh5&clientVersion=9.1.0`, + headers: { + Cookie: cookie, + origin: "https://h5.m.jd.com", + referer: "https://h5.m.jd.com/", + "Content-Type": "application/x-www-form-urlencoded", + "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", + }, + }; +} +// prettier-ignore +function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From fef21f4097231eddf8a5ed085378b63faa037c60 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 15:19:15 +0800 Subject: [PATCH 47/52] debug --- jd_bean_sign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jd_bean_sign.js b/jd_bean_sign.js index fb3fee0e..5ab774c7 100644 --- a/jd_bean_sign.js +++ b/jd_bean_sign.js @@ -131,7 +131,7 @@ async function downFile () { async function changeFile (content) { console.log(`开始替换变量`) let newContent = content.replace(/var Key = ''/, `var Key = '${cookie}'`); - newContent = newContent.replace(/const NodeSet = 'CookieSet.json'/, `const NodeSet = '${NodeSet}'`) + // newContent = newContent.replace(/const NodeSet = 'CookieSet.json'/, `const NodeSet = '${NodeSet}'`) if (process.env.JD_BEAN_STOP && process.env.JD_BEAN_STOP !== '0') { newContent = newContent.replace(/var stop = 0/, `var stop = ${process.env.JD_BEAN_STOP * 1}`); } From bea3a381fba6f8a51e6c959c23d5cf614503f8a4 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 17:39:33 +0800 Subject: [PATCH 48/52] =?UTF-8?q?=E6=94=B9=E4=B8=BAPromise.all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_bean_sign.js | 2 +- sendNotify.js | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/jd_bean_sign.js b/jd_bean_sign.js index 5ab774c7..fb3fee0e 100644 --- a/jd_bean_sign.js +++ b/jd_bean_sign.js @@ -131,7 +131,7 @@ async function downFile () { async function changeFile (content) { console.log(`开始替换变量`) let newContent = content.replace(/var Key = ''/, `var Key = '${cookie}'`); - // newContent = newContent.replace(/const NodeSet = 'CookieSet.json'/, `const NodeSet = '${NodeSet}'`) + newContent = newContent.replace(/const NodeSet = 'CookieSet.json'/, `const NodeSet = '${NodeSet}'`) if (process.env.JD_BEAN_STOP && process.env.JD_BEAN_STOP !== '0') { newContent = newContent.replace(/var stop = 0/, `var stop = ${process.env.JD_BEAN_STOP * 1}`); } diff --git a/sendNotify.js b/sendNotify.js index e32a197b..b23e2e12 100644 --- a/sendNotify.js +++ b/sendNotify.js @@ -2,7 +2,7 @@ * @Author: lxk0301 https://github.com/lxk0301 * @Date: 2020-08-19 16:12:40 * @Last Modified by: lxk0301 - * @Last Modified time: 2020-12-21 13:52:54 + * @Last Modified time: 2021-1-5 17:52:54 */ const querystring = require("querystring"); const $ = new Env(); @@ -132,17 +132,21 @@ if (process.env.PUSH_PLUS_USER) { async function sendNotify(text, desp, params = {}) { //提供7种通知 - await serverNotify(text, desp);//微信server酱 - await pushPlusNotify(text, desp);//pushplus(推送加) + await Promise.all([ + serverNotify(text, desp),//微信server酱 + pushPlusNotify(text, desp)//pushplus(推送加) + ]) //由于上述两种微信通知需点击进去才能查看到详情,故text(标题内容)携带了账号序号以及昵称信息,方便不点击也可知道是哪个京东哪个活动 text = text.match(/.*?(?=\s?-)/g) ? text.match(/.*?(?=\s?-)/g)[0] : text; - await BarkNotify(text, desp, params);//iOS Bark APP - await tgBotNotify(text, desp);//telegram 机器人 - await ddBotNotify(text, desp);//钉钉机器人 - await qywxBotNotify(text, desp); //企业微信机器人 - await qywxamNotify(text, desp); //企业微信应用消息推送 - await iGotNotify(text, desp, params);//iGot - await CoolPush(text, desp);//QQ酷推 + await Promise.all([ + BarkNotify(text, desp, params),//iOS Bark APP + tgBotNotify(text, desp),//telegram 机器人 + ddBotNotify(text, desp),//钉钉机器人 + qywxBotNotify(text, desp), //企业微信机器人 + qywxamNotify(text, desp), //企业微信应用消息推送 + iGotNotify(text, desp, params),//iGot + CoolPush(text, desp)//QQ酷推 + ]) } function serverNotify(text, desp, timeout = 2100) { From 10b74ab144dc103d563f86b3e1b3e58bc1915b68 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 18:02:44 +0800 Subject: [PATCH 49/52] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=90=84=E7=B1=BB?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E9=82=80=E8=AF=B7=E7=A0=81=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0cookie=E8=BF=87=E6=9C=9F=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=8C=E5=90=A6=E5=88=99=E8=84=9A=E6=9C=AC=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E4=BC=9A=E6=89=A7=E8=A1=8C=E5=87=BA=E9=94=99=E4=B8=AD=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++-- jd_get_share_code.js | 65 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 56 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 682c55cb..f7497952 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,10 @@ **TODO** - [ ] 所有活动互助码在一个脚本打印 -## [邀请码互助入口](https://github.com/lxk0301/jd_scripts/discussions) - +## 邀请码互助 + - [邀请码互助入口](https://github.com/lxk0301/jd_scripts/discussions) + - [获取各类活动互助码脚本](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdfactory.js) + - [邀请码使用规范](githubAction.md#互助码类环境变量)(仅限云端) ## 食用方法 ### 方法一:本地安装Node.js,下载本库脚本 diff --git a/jd_get_share_code.js b/jd_get_share_code.js index 46357d5b..5b44c5cb 100644 --- a/jd_get_share_code.js +++ b/jd_get_share_code.js @@ -144,11 +144,14 @@ if ($.isNode()) { $.isLogin = true; $.nickName = ''; message = ''; + await TotalBean(); + if (!$.isLogin) { + continue + } console.log(`======账号${$.index}开始======`) await getShareCode() - console.log(`======账号${$.index}结束======`) + console.log(`======账号${$.index}结束======\n`) } - } })() .catch((e) => { @@ -174,7 +177,7 @@ function getJdFactory() { $.taskVos.map((item) => { if (item.taskType === 14) { console.log( - `【东东工厂】${item.assistTaskDetailVo.taskToken}` + `【账号${$.index}(${$.nickName || $.UserName})东东工厂】${item.assistTaskDetailVo.taskToken}` ); } }); @@ -238,7 +241,7 @@ function getJxFactory(){ $.commodityDimId = production.commodityDimId; $.encryptPin = data.user.encryptPin; // subTitle = data.user.pin; - console.log(`【惊喜工厂】${data.user.encryptPin}`); + console.log(`【账号${$.index}(${$.nickName || $.UserName})惊喜工厂】${data.user.encryptPin}`); } } else { $.unActive = false; //标记是否开启了京喜活动或者选购了商品进行生产 @@ -317,7 +320,7 @@ function getJdPet(){ } console.log( - `【京东萌宠】${$.petInfo.shareCode}` + `【账号${$.index}(${$.nickName || $.UserName})京东萌宠】${$.petInfo.shareCode}` ); } else if (initPetTownRes.code === "0") { @@ -348,7 +351,7 @@ async function getJdZZ() { if (safeGet(data)) { data = JSON.parse(data); if (data.data.shareTaskRes) { - console.log(`【京东赚赚】${data.data.shareTaskRes.itemId}`); + console.log(`【账号${$.index}(${$.nickName || $.UserName})京东赚赚】${data.data.shareTaskRes.itemId}`); } else { //console.log(`已满5人助力,暂时看不到您的京东赚赚好友助力码`) } @@ -449,7 +452,7 @@ async function getPlantBean() { if ($.plantBeanIndexResult.code === "0") { const shareUrl = $.plantBeanIndexResult.data.jwordShareInfo.shareUrl; $.myPlantUuid = getParam(shareUrl, "plantUuid"); - console.log(`【种豆得豆】${$.myPlantUuid}`); + console.log(`【账号${$.index}(${$.nickName || $.UserName})种豆得豆】${$.myPlantUuid}`); } else { console.log( @@ -513,11 +516,8 @@ async function getJDFruit() { async function jdFruit() { await initForFarm(); if ($.farmInfo.farmUserPro) { - // option['media-url'] = $.farmInfo.farmUserPro.goodsImage; - subTitle = `【京东账号${$.index}】${$.nickName}`; - message = `【水果名称】${$.farmInfo.farmUserPro.name}`; console.log( - `【京东农场】${$.farmInfo.farmUserPro.shareCode}` + `【账号${$.index}(${$.nickName || $.UserName})京东农场】${$.farmInfo.farmUserPro.shareCode}` ); } else { @@ -563,7 +563,7 @@ async function getJoy(){ if (safeGet(data)) { data = JSON.parse(data); if (data.success && data.data && data.data.userInviteCode) { - console.log(`【crazyJoy】${data.data.userInviteCode}`) + console.log(`【账号${$.index}(${$.nickName || $.UserName})crazyJoy】${data.data.userInviteCode}`) } } } @@ -596,7 +596,46 @@ function safeGet(data) { return false; } } - +function TotalBean() { + return new Promise(async resolve => { + const options = { + "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, + "headers": { + "Accept": "application/json,text/plain, */*", + "Content-Type": "application/x-www-form-urlencoded", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "zh-cn", + "Connection": "keep-alive", + "Cookie": cookie, + "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2", + "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") + } + } + $.post(options, (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (data) { + data = JSON.parse(data); + if (data['retcode'] === 13) { + $.isLogin = false; //cookie过期 + return + } + $.nickName = data['base'].nickname; + } else { + console.log(`京东服务器返回空数据`) + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} function taskPostUrl(function_id, body = {}, function_id2) { let url = `${JD_API_HOST}`; if (function_id2) { From bb58352b914a01b5d68f0f986bfd82423fba7d65 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 18:04:26 +0800 Subject: [PATCH 50/52] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=90=84=E7=B1=BB?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E9=82=80=E8=AF=B7=E7=A0=81=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0cookie=E8=BF=87=E6=9C=9F=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=8C=E5=90=A6=E5=88=99=E8=84=9A=E6=9C=AC=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E4=BC=9A=E6=89=A7=E8=A1=8C=E5=87=BA=E9=94=99=E4=B8=AD=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7497952..245ab57f 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ ## 邀请码互助 - [邀请码互助入口](https://github.com/lxk0301/jd_scripts/discussions) - - [获取各类活动互助码脚本](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdfactory.js) + - [获取各类活动互助码脚本 jd_get_share_code.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_get_share_code.js) - [邀请码使用规范](githubAction.md#互助码类环境变量)(仅限云端) ## 食用方法 From a01115b999eb4b21b7e176baf2414f54f75925d7 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 18:53:22 +0800 Subject: [PATCH 51/52] Update jd_crazy_joy_coin.js --- jd_crazy_joy_coin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jd_crazy_joy_coin.js b/jd_crazy_joy_coin.js index 669bf766..8824b85a 100644 --- a/jd_crazy_joy_coin.js +++ b/jd_crazy_joy_coin.js @@ -287,9 +287,9 @@ function getJoyShop() { if (data.success && data.data && data.data.shop) { const shop = data.data.shop.filter(vo => vo.status === 1) || [] $.buyJoyLevel = shop.length ? shop[shop.length - 1]['joyId'] : 1;//可购买的最大等级 - if ($.isNode() && process.env.BUY_JPY_LEVEL) { + if ($.isNode() && process.env.BUY_JOY_LEVEL) { $.log(`当前可购买的最高JOY等级为${$.buyJoyLevel}级\n`) - $.buyJoyLevel = (process.env.BUY_JPY_LEVEL * 1) > $.buyJoyLevel ? $.buyJoyLevel : process.env.BUY_JPY_LEVEL * 1; + $.buyJoyLevel = (process.env.BUY_JOY_LEVEL * 1) > $.buyJoyLevel ? $.buyJoyLevel : process.env.BUY_JOY_LEVEL * 1; $.cost = shop[$.buyJoyLevel - 1]['coins'] } else { $.cost = shop.length ? shop[shop.length - 1]['coins'] : Infinity From 56114e413cfe73ea7469c3c5cc34fc5fa224396f Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Tue, 5 Jan 2021 20:48:14 +0800 Subject: [PATCH 52/52] Update qqread.js --- backUp/qqread.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backUp/qqread.js b/backUp/qqread.js index f72fe1f4..0ff1d2d9 100644 --- a/backUp/qqread.js +++ b/backUp/qqread.js @@ -62,7 +62,9 @@ const jsname = '企鹅读书' const $ = Env(jsname) let task = '', config, ssr2 = '', wktime, day = 0; console.log(`\n========= 脚本执行时间(TM):${new Date(new Date().getTime() + 0 * 60 * 60 * 1000).toLocaleString('zh', {hour12: false})} =========\n`) -const notify = require('../sendNotify'); + +const notify = $.isNode() ? require('../sendNotify') : ''; + const logs = 1; //0为关闭日志,1为开启 const TIME = 30//单次时长上传限制,默认5分钟