Merge pull request #21 from lxk0301/master

Master
This commit is contained in:
any
2021-01-06 21:54:33 +08:00
committed by GitHub
19 changed files with 535 additions and 152 deletions

View File

@@ -66,10 +66,13 @@
**脚本兼容: [QuantumultX](https://apps.apple.com/us/app/quantumult-x/id1443988620), [Surge](https://apps.apple.com/us/app/surge-4/id1442620678), [Loon](https://apps.apple.com/us/app/loon/id1373567447), 小火箭, JSBox, Node.js** **脚本兼容: [QuantumultX](https://apps.apple.com/us/app/quantumult-x/id1443988620), [Surge](https://apps.apple.com/us/app/surge-4/id1442620678), [Loon](https://apps.apple.com/us/app/loon/id1373567447), 小火箭, JSBox, Node.js**
**TODO** **TODO**
- [ ] 所有活动互助码在一个脚本打印 - [x] 所有活动互助码在一个脚本打印
- [ ] 京喜工厂添加预测N天后可兑换功能
## [邀请码互助入口](https://github.com/lxk0301/jd_scripts/discussions)
## 邀请码互助
- [邀请码互助入口](https://github.com/lxk0301/jd_scripts/discussions)
- [获取各类活动互助码脚本 jd_get_share_code.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_get_share_code.js)
- [邀请码使用规范](githubAction.md#互助码类环境变量)(仅限云端)
## 食用方法 ## 食用方法
### 方法一本地安装Node.js下载本库脚本 ### 方法一本地安装Node.js下载本库脚本
@@ -85,9 +88,9 @@
### 方法二:云服务器、腾讯云函数等等 ### 方法二:云服务器、腾讯云函数等等
- 需自行有云服务器,云函数等 - 需自行有云服务器,云函数等
- 腾讯云云函数 [快速部署教程](tencentscf.md)(免费) - 腾讯云云函数 [快速部署教程](./backUp/tencentscf.md)(免费)
- 腾讯云云函数控制台使用 [教程说明](iCloud.md) - 腾讯云云函数控制台使用 [教程说明](./backUp/iCloud.md)
- 腾讯云云函数 [GitHub Action部署教程](tencentscf.md#github-action-部署) - 腾讯云云函数 [GitHub Action部署教程](./backUp/tencentscf.md#github-action-部署)
### 方法三DockerNAS或VPS用户 ### 方法三DockerNAS或VPS用户
@@ -107,7 +110,7 @@
### 方法四iOS系统的代理软件QuantumultX, Surge, Loon, 小火箭) ### 方法四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)
### 赞赏码(开发维护不易,请赏杯茶水费) ### 赞赏码(开发维护不易,请赏杯茶水费)
<div align=center><img width="250" height="250" src="https://raw.githubusercontent.com/lxk0301/jd_scripts/master/icon/thanks.jpg"/></div> <div align=center><img width="250" height="250" src="https://raw.githubusercontent.com/lxk0301/jd_scripts/master/icon/thanks.jpg"/></div>

View File

@@ -108,21 +108,21 @@ let CookieJDs = [
单击左侧导航栏**函数服务**,进入“函数服务”页面。 单击左侧导航栏**函数服务**,进入“函数服务”页面。
在页面上方选择一个地域,最好选择离你常用地区近点的,不至于导致账号异常。单击**新建**。如下图所示: 在页面上方选择一个地域,最好选择离你常用地区近点的,不至于导致账号异常。单击**新建**。如下图所示:
![iCloud1](./icon/iCloud1.png) ![iCloud1](../icon/iCloud1.png)
在“新建函数”页面填写函数基础信息,单击**下一步**。如下图所示: 在“新建函数”页面填写函数基础信息,单击**下一步**。如下图所示:
![iCloud2](./icon/iCloud2.png) ![iCloud2](../icon/iCloud2.png)
**函数名称**可以自定义比如为jd。<br>**运行环境**:选择 “Nodejs 12.16”。<br>**创建方式**:选择 “空白函数”。 **函数名称**可以自定义比如为jd。<br>**运行环境**:选择 “Nodejs 12.16”。<br>**创建方式**:选择 “空白函数”。
确保环境为Nodejs 12.16执行方法改为index.main_handler提交方式建议选本地文件夹然后从GitHub项目克隆Zip压缩包解压成文件夹然后点击这个上传把文件夹上传进来记得node_modules文件夹一并上传或者将node_modules文件夹上传到“层”之后选择“函数管理”-“层管理”绑定上传好的层),完了后点击下面的高级设置。 确保环境为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秒然后点击最下面的完成。 内存用不了太大64MB就够了64M内存免费时长6,400,000秒内存与免费时长大致关系可以参看云函数官方说明超时时间改为最大的900秒然后点击最下面的完成。
![iCloud4](./icon/iCloud4.png) ![iCloud4](../icon/iCloud4.png)
## 5.设置触发器 ## 5.设置触发器
@@ -136,7 +136,7 @@ let CookieJDs = [
创建触发器 创建触发器
![iCloud6](./icon/iCloud6.png) ![iCloud6](../icon/iCloud6.png)
触发方式默认“**定时触发**”,定时任务名称随便起个名字,触发周期根据自己需要自行设置。 触发方式默认“**定时触发**”,定时任务名称随便起个名字,触发周期根据自己需要自行设置。

View File

@@ -14,27 +14,6 @@ ziye
本人github地址 https://github.com/ziye12/JavaScript 本人github地址 https://github.com/ziye12/JavaScript
转载请备注个名字,谢谢 转载请备注个名字,谢谢
11.25 增加 阅读时长上传,阅读金币,阅读随机金币
11.25 修复翻倍宝箱不同时领取的问题.增加阅读金币判定
11.25 修复阅读时长问题阅读金币问题请重新获取时长cookie
11.26 随机金币只有一次,故去除,调整修复阅读金币问题,增加时长上传限制
11.26 增加领取周时长奖励
11.26 增加结束命令
11.27 调整通知为,成功开启宝箱再通知
11.28 修复错误
12.1 调整通知为15次宝箱通知一次
12.1 优化通知
cookie获取方法
进 https://m.q.qq.com/a/s/d3eacc70120b9a37e46bad408c0c4c2a 点我的 获取cookie
进一本书 看 10秒以下 然后退出获取阅读时长cookie看书一定不能超过10秒
可能某些页面会卡住但是能获取到cookie再注释cookie重写就行了
宝箱奖励为20分钟一次自己根据情况设置定时建议设置11分钟一次 宝箱奖励为20分钟一次自己根据情况设置定时建议设置11分钟一次
hostname=mqqapi.reader.qq.com hostname=mqqapi.reader.qq.com
@@ -62,7 +41,9 @@ const jsname = '企鹅读书'
const $ = Env(jsname) const $ = Env(jsname)
let task = '', config, ssr2 = '', wktime, day = 0; 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`) 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 logs = 1; //0为关闭日志1为开启
const TIME = 30//单次时长上传限制默认5分钟 const TIME = 30//单次时长上传限制默认5分钟
@@ -78,6 +59,7 @@ let qqreadtimeurlVal = $.getdata(qqreadtimeurlKey)
const qqreadtimeheaderKey = 'qqreadtimehd' const qqreadtimeheaderKey = 'qqreadtimehd'
let qqreadtimeheaderVal = $.getdata(qqreadtimeheaderKey) let qqreadtimeheaderVal = $.getdata(qqreadtimeheaderKey)
let nowTimes = new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000);
//云函数使用在下面填写 //云函数使用在下面填写
let QQ_READ_COOKIES = [ let QQ_READ_COOKIES = [
{ {
@@ -177,7 +159,7 @@ function GetCookie() {
async function QQ_READ() { async function QQ_READ() {
for (let i = 0; i < QQ_READ_COOKIES.length; i++) { for (let i = 0; i < QQ_READ_COOKIES.length; i++) {
$.log(`\n*************开始QQ账号${i + 1}**************\n`); $.log(`\n*************开始QQ账号${i + 1}**************\n`);
tz = ''; $.isLogin = true;
if (!QQ_READ_COOKIES[i]["qqreadbodyVal"] || !QQ_READ_COOKIES[i]['qqreadtimeurlVal'] || !QQ_READ_COOKIES[i]['qqreadtimeheaderVal']) { if (!QQ_READ_COOKIES[i]["qqreadbodyVal"] || !QQ_READ_COOKIES[i]['qqreadtimeurlVal'] || !QQ_READ_COOKIES[i]['qqreadtimeheaderVal']) {
$.log(`账号${i + 1}暂未提供脚本执行所需的cookie`); $.log(`账号${i + 1}暂未提供脚本执行所需的cookie`);
continue continue
@@ -186,6 +168,13 @@ async function QQ_READ() {
qqreadtimeurlVal = QQ_READ_COOKIES[i]['qqreadtimeurlVal']; qqreadtimeurlVal = QQ_READ_COOKIES[i]['qqreadtimeurlVal'];
qqreadtimeheaderVal = QQ_READ_COOKIES[i]['qqreadtimeheaderVal']; qqreadtimeheaderVal = QQ_READ_COOKIES[i]['qqreadtimeheaderVal'];
await qqreadinfo();//用户名 await qqreadinfo();//用户名
if (!$.isLogin) {
$.log(`企鹅阅读账号${i + 1} cookie过期`);
if (nowTimes.getHours() % 12 === 0 && (nowTimes.getMinutes() > 0 && nowTimes.getMinutes() <= 15)) {
await notify.sendNotify(`企鹅阅读账号${i + 1} cookie过期`, '请及时更新 QQ_READ_TIME_HEADER_VAL')
}
continue
}
await qqreadwktime();//周时长查询 await qqreadwktime();//周时长查询
await qqreadtrack(); await qqreadtrack();
await qqreadconfig();//时长查询 await qqreadconfig();//时长查询
@@ -234,8 +223,7 @@ async function QQ_READ() {
} }
function showmsg() { function showmsg() {
return new Promise(async resolve => { return new Promise(async resolve => {
let nowTimes = new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000); if (nowTimes.getHours() === 22 && (nowTimes.getMinutes() > 0 && nowTimes.getMinutes() <= 15)) {
if (nowTimes.getHours() === 22 && (nowTimes.getMinutes() >= 0 && nowTimes.getMinutes() <= 15)) {
await notify.sendNotify(jsname, tz); await notify.sendNotify(jsname, tz);
} }
$.msg(jsname, "", tz); $.msg(jsname, "", tz);
@@ -326,6 +314,13 @@ function qqreadinfo() {
$.get(toqqreadinfourl, (error, response, data) => { $.get(toqqreadinfourl, (error, response, data) => {
if (logs) $.log(`${jsname}, 用户名: ${data}`); if (logs) $.log(`${jsname}, 用户名: ${data}`);
let info = JSON.parse(data); let info = JSON.parse(data);
if (info.code === 0) {
$.isLogin = info.data['isLogin'];
if (!$.isLogin) {
resolve();
return
}
}
kz += `\n========== 【${info.data.user.nickName}】 ==========\n`; kz += `\n========== 【${info.data.user.nickName}】 ==========\n`;
tz += `\n========== 【${info.data.user.nickName}】 ==========\n`; tz += `\n========== 【${info.data.user.nickName}】 ==========\n`;

293
backUp/qqreadOpenBox.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -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`) 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++) { for (let i = 0; i < CookieJDs.length; i++) {
const index = (i + 1 === 1) ? '' : (i + 1); const index = (i + 1 === 1) ? '' : (i + 1);
exports['CookieJD' + index] = CookieJDs[i]; exports['CookieJD' + index] = CookieJDs[i].trim();
} }

View File

@@ -287,9 +287,9 @@ function getJoyShop() {
if (data.success && data.data && data.data.shop) { if (data.success && data.data && data.data.shop) {
const shop = data.data.shop.filter(vo => vo.status === 1) || [] const shop = data.data.shop.filter(vo => vo.status === 1) || []
$.buyJoyLevel = shop.length ? shop[shop.length - 1]['joyId'] : 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`) $.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'] $.cost = shop[$.buyJoyLevel - 1]['coins']
} else { } else {
$.cost = shop.length ? shop[shop.length - 1]['coins'] : Infinity $.cost = shop.length ? shop[shop.length - 1]['coins'] : Infinity

View File

@@ -1,6 +1,6 @@
/* /*
东东水果:脚本更新地址 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js 东东水果:脚本更新地址 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 东东农场活动链接https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html
已支持IOS双京东账号,Node.js支持N个京东账号 已支持IOS双京东账号,Node.js支持N个京东账号
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
@@ -29,9 +29,9 @@ let cookiesArr = [], cookie = '', jdFruitShareArr = [], isBox = false, notify, n
//下面给出两个账号的填写示例iOS只支持2个京东账号 //下面给出两个账号的填写示例iOS只支持2个京东账号
let shareCodes = [ // 这个列表填入你要助力的好友的shareCode let shareCodes = [ // 这个列表填入你要助力的好友的shareCode
//账号一的好友shareCode,不同好友的shareCode中间用@符号隔开 //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
'0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3@6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6@56db8e7bc5874668ba7d5195230d067a', '0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3@6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6@56db8e7bc5874668ba7d5195230d067a@',
//账号二的好友shareCode,不同好友的shareCode中间用@符号隔开 //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
'b1638a774d054a05a30a17d3b4d364b8@f92cb56c6a1349f5a35f0372aa041ea0@9c52670d52ad4e1a812f894563c746ea@8175509d82504e96828afc8b1bbb9cb3', 'b1638a774d054a05a30a17d3b4d364b8@f92cb56c6a1349f5a35f0372aa041ea0@9c52670d52ad4e1a812f894563c746ea@8175509d82504e96828afc8b1bbb9cb3@2673c3777d4443829b2a635059953a28',
] ]
let message = '', subTitle = '', option = {}, isFruitFinished = false; let message = '', subTitle = '', option = {}, isFruitFinished = false;
const retainWater = 100;//保留水滴大于多少g,默认100g; const retainWater = 100;//保留水滴大于多少g,默认100g;
@@ -771,8 +771,11 @@ async function clockInIn() {
// //
async function getAwardInviteFriend() { async function getAwardInviteFriend() {
await friendListInitForFarm();//查询好友列表 await friendListInitForFarm();//查询好友列表
console.log(`查询好友列表数据:${JSON.stringify($.friendList)}\n`)
if ($.friendList) {
console.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}`); console.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}`);
console.log(`开始删除${$.friendList.friends.length}个好友,可拿每天的邀请奖励`); console.log(`开始删除${$.friendList.friends && $.friendList.friends.length}个好友,可拿每天的邀请奖励`);
if ($.friendList.friends && $.friendList.friends.length > 0) {
for (let friend of $.friendList.friends) { for (let friend of $.friendList.friends) {
console.log(`\n开始删除好友 [${friend.shareCode}]`); console.log(`\n开始删除好友 [${friend.shareCode}]`);
const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 }); const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 });
@@ -780,6 +783,7 @@ async function getAwardInviteFriend() {
console.log(`删除好友 [${friend.shareCode}] 成功\n`); console.log(`删除好友 [${friend.shareCode}] 成功\n`);
} }
} }
}
await receiveFriendInvite();//为他人助力,接受邀请成为别人的好友 await receiveFriendInvite();//为他人助力,接受邀请成为别人的好友
if ($.friendList.inviteFriendCount > 0) { if ($.friendList.inviteFriendCount > 0) {
if ($.friendList.inviteFriendCount > $.friendList.inviteFriendGotAwardCount) { if ($.friendList.inviteFriendCount > $.friendList.inviteFriendGotAwardCount) {
@@ -790,6 +794,9 @@ async function getAwardInviteFriend() {
} else { } else {
console.log('今日未邀请过好友') console.log('今日未邀请过好友')
} }
} else {
console.log(`查询好友列表失败\n`);
}
} }
//给好友浇水 //给好友浇水
async function doFriendsWater() { async function doFriendsWater() {

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
/* /*
宠汪汪积分兑换奖品脚本, 目前脚本只兑换京豆,兑换京豆成功,才会发出通知提示,其他情况不通知。 宠汪汪积分兑换奖品脚本, 目前脚本只兑换京豆,兑换京豆成功,才会发出通知提示,其他情况不通知。
更新时间2020-12-23 更新时间2021-1-6
兑换规则:一个账号一天只能兑换一次京豆。 兑换规则:一个账号一天只能兑换一次京豆。
兑换奖品成功后才会有系统弹窗通知 兑换奖品成功后才会有系统弹窗通知
每日京豆库存会在0:00、8:00、16:00更新经测试发现中午12:00也会有补发京豆。 每日京豆库存会在0:00、8:00、16:00更新经测试发现中午12:00也会有补发京豆。
@@ -127,9 +127,9 @@ async function joyReward() {
ctrTemp = `${jdNotify}` === 'false'; ctrTemp = `${jdNotify}` === 'false';
} }
if (ctrTemp) { if (ctrTemp) {
$.msg($.name, `兑换${giftValue}京豆成功`, `【京东账号${$.index}${$.nickName}\n【宠物等级】${data.level}\n【积分详情】消耗积分 ${salePrice}, 剩余积分 ${data.coin - salePrice}`); $.msg($.name, ``, `【京东账号${$.index}${$.nickName}\n${giftValue}京豆】兑换成功\n宠物等级】${data.level}\n【积分详情】消耗积分 ${salePrice}, 剩余积分 ${data.coin - salePrice}`);
if ($.isNode()) { if ($.isNode()) {
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}${$.nickName}\n兑换${giftValue}京豆】成功\n【宠物等级】${data.level}\n【积分详情】消耗积分 ${salePrice}, 剩余积分 ${data.coin - salePrice}`); await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}${$.nickName}\n${giftValue}京豆】兑换成功\n【宠物等级】${data.level}\n【积分详情】消耗积分 ${salePrice}, 剩余积分 ${data.coin - salePrice}`);
} }
} }
// if ($.isNode()) { // if ($.isNode()) {

View File

@@ -1,6 +1,6 @@
/** /**
宠汪汪邀请助力与赛跑助力脚本感谢github@Zero-S1提供帮助 宠汪汪邀请助力与赛跑助力脚本感谢github@Zero-S1提供帮助
更新时间2020-12-16宠汪汪助力更新Token的配置正则表达式已改 更新时间2021-1-6宠汪汪助力更新Token的配置正则表达式已改
token时效很短几个小时就失效了,闲麻烦的放弃就行 token时效很短几个小时就失效了,闲麻烦的放弃就行
每天拿到token后可一次性运行完毕即可。 每天拿到token后可一次性运行完毕即可。
@@ -245,12 +245,8 @@ async function invite(invite_pins) {
for (let item of invite_pins.map(item => item.trim())) { for (let item of invite_pins.map(item => item.trim())) {
console.log(`\n账号${$.index} [${UserName}] 开始给好友 [${item}] 进行邀请助力`) console.log(`\n账号${$.index} [${UserName}] 开始给好友 [${item}] 进行邀请助力`)
const data = await enterRoom(item); const data = await enterRoom(item);
if (!data.success && data.errorCode === 'B0001') { if (data) {
console.log('京东Cookie失效'); if (data.success) {
$.msg($.name, `【提示】京东cookie已失效`, `京东账号${$.index} ${UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
$.jdLogin = false;
break
} else {
const { helpStatus } = data.data; const { helpStatus } = data.data;
console.log(`helpStatus ${helpStatus}`) console.log(`helpStatus ${helpStatus}`)
if (helpStatus=== 'help_full') { if (helpStatus=== 'help_full') {
@@ -276,6 +272,14 @@ async function invite(invite_pins) {
} }
} }
$.jdLogin = true; $.jdLogin = true;
} else {
if (data.errorCode === 'B0001') {
console.log('京东Cookie失效');
$.msg($.name, `【提示】京东cookie已失效`, `京东账号${$.index} ${UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
$.jdLogin = false;
break
}
}
} }
} }
// if ($.inviteReward > 0) { // if ($.inviteReward > 0) {
@@ -287,14 +291,15 @@ function enterRoom(invitePin) {
headers.Cookie = cookie; headers.Cookie = cookie;
headers.LKYLToken = $.LKYLToken; headers.LKYLToken = $.LKYLToken;
const options = { const options = {
url: `${JD_BASE_API}/enterRoom?reqSource=weapp&invitePin=${encodeURI(invitePin)}`, url: `${JD_BASE_API}/enterRoom/h5?reqSource=weapp&invitePin=${encodeURI(invitePin)}&inviteSource=task_invite&shareSource=weapp&inviteTimeStamp=${Date.now()}`,
body: '{}',
headers headers
} }
$.get(options, (err, resp, data) => { $.post(options, (err, resp, data) => {
try { try {
if (err) { if (err) {
$.log('API请求失败') $.log(`${$.name} API请求失败`)
$.logErr(JSON.stringify(err)); $.log(JSON.stringify(err))
} else { } else {
data = JSON.parse(data); data = JSON.parse(data);
// console.log('进入房间', data) // console.log('进入房间', data)

View File

@@ -1,6 +1,6 @@
/* /*
东东萌宠 更新地址: https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js 东东萌宠 更新地址: https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js
更新时间2020-12-26 更新时间2021-01-06
已支持IOS双京东账号,Node.js支持N个京东账号 已支持IOS双京东账号,Node.js支持N个京东账号
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
@@ -231,8 +231,10 @@ async function masterHelpInit() {
if(!res.result.addedBonusFlag) { if(!res.result.addedBonusFlag) {
console.log("开始领取额外奖励"); console.log("开始领取额外奖励");
let getHelpAddedBonusResult = await request('getHelpAddedBonus'); let getHelpAddedBonusResult = await request('getHelpAddedBonus');
console.log(`领取30g额外奖励结果${getHelpAddedBonusResult.message}`); if (getHelpAddedBonusResult.resultCode === '0') {
message += `【额外奖励${getHelpAddedBonusResult.result.reward}领取】${getHelpAddedBonusResult.message}\n`; message += `【额外奖励${getHelpAddedBonusResult.result.reward}领取】${getHelpAddedBonusResult.message}\n`;
}
console.log(`领取30g额外奖励结果${getHelpAddedBonusResult.message}`);
} else { } else {
console.log("已经领取过5好友助力额外奖励"); console.log("已经领取过5好友助力额外奖励");
message += `【额外奖励】已领取\n`; message += `【额外奖励】已领取\n`;
@@ -261,6 +263,8 @@ async function masterHelpInit() {
* 运行脚本时你自己的shareCode会在控制台输出, 可以将其分享给他人 * 运行脚本时你自己的shareCode会在控制台输出, 可以将其分享给他人
*/ */
async function slaveHelp() { async function slaveHelp() {
$.log(`\n因1.6日好友助力功能下线。故暂时屏蔽\n`)
return
let helpPeoples = ''; let helpPeoples = '';
for (let code of newShareCodes) { for (let code of newShareCodes) {
console.log(`开始助力京东账号${$.index} - ${$.nickName}的好友: ${code}`); console.log(`开始助力京东账号${$.index} - ${$.nickName}的好友: ${code}`);
@@ -281,7 +285,7 @@ async function slaveHelp() {
console.log(`助力其他情况:${JSON.stringify(response)}`); console.log(`助力其他情况:${JSON.stringify(response)}`);
} }
} else { } else {
console.log(`好友结果: ${response.message}`); console.log(`好友结果: ${response.message}`);
} }
} }
if (helpPeoples && helpPeoples.length > 0) { if (helpPeoples && helpPeoples.length > 0) {
@@ -467,7 +471,9 @@ function shareCodesFormat() {
const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1); const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
newShareCodes = shareCodes[tempIndex].split('@'); newShareCodes = shareCodes[tempIndex].split('@');
} }
const readShareCodeRes = await readShareCode(); //因好友助力功能下线。故暂时屏蔽
// const readShareCodeRes = await readShareCode();
const readShareCodeRes = null;
if (readShareCodeRes && readShareCodeRes.code === 200) { if (readShareCodeRes && readShareCodeRes.code === 200) {
newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])]; newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
} }

View File

@@ -2,7 +2,7 @@
* @Author: lxk0301 https://github.com/lxk0301 * @Author: lxk0301 https://github.com/lxk0301
* @Date: 2020-08-19 16:12:40 * @Date: 2020-08-19 16:12:40
* @Last Modified by: lxk0301 * @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 querystring = require("querystring");
const $ = new Env(); const $ = new Env();
@@ -49,7 +49,8 @@ let DD_BOT_SECRET = '';
let QYWX_KEY = ''; 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
//增加一个选择推送消息类型用图文消息直接填写素材库图片id的值用卡片消息就填写0(就是数字零)
//注此处设置github action用户填写到Settings-Secrets里面(Name输入QYWX_AM) //注此处设置github action用户填写到Settings-Secrets里面(Name输入QYWX_AM)
let QYWX_AM = ''; let QYWX_AM = '';
@@ -132,17 +133,21 @@ if (process.env.PUSH_PLUS_USER) {
async function sendNotify(text, desp, params = {}) { async function sendNotify(text, desp, params = {}) {
//提供7种通知 //提供7种通知
await serverNotify(text, desp);//微信server酱 await Promise.all([
await pushPlusNotify(text, desp);//pushplus(推送加) serverNotify(text, desp),//微信server酱
pushPlusNotify(text, desp)//pushplus(推送加)
])
//由于上述两种微信通知需点击进去才能查看到详情故text(标题内容)携带了账号序号以及昵称信息,方便不点击也可知道是哪个京东哪个活动 //由于上述两种微信通知需点击进去才能查看到详情故text(标题内容)携带了账号序号以及昵称信息,方便不点击也可知道是哪个京东哪个活动
text = text.match(/.*?(?=\s?-)/g) ? text.match(/.*?(?=\s?-)/g)[0] : text; text = text.match(/.*?(?=\s?-)/g) ? text.match(/.*?(?=\s?-)/g)[0] : text;
await BarkNotify(text, desp, params);//iOS Bark APP await Promise.all([
await tgBotNotify(text, desp);//telegram 机器人 BarkNotify(text, desp, params),//iOS Bark APP
await ddBotNotify(text, desp);//钉钉机器人 tgBotNotify(text, desp),//telegram 机器人
await qywxBotNotify(text, desp); //企业微信机器人 ddBotNotify(text, desp),//钉钉机器人
await qywxamNotify(text, desp); //企业微信应用消息推送 qywxBotNotify(text, desp), //企业微信机器人
await iGotNotify(text, desp, params);//iGot qywxamNotify(text, desp), //企业微信应用消息推送
await CoolPush(text, desp);//QQ酷推 iGotNotify(text, desp, params),//iGot
CoolPush(text, desp)//QQ酷推
])
} }
function serverNotify(text, desp, timeout = 2100) { function serverNotify(text, desp, timeout = 2100) {
@@ -431,9 +436,28 @@ function qywxamNotify(text, desp) {
}, },
}; };
$.post(options_accesstoken, (err, resp, data) => { $.post(options_accesstoken, (err, resp, data) => {
html=desp.replace(/\n/g,"<br/>")
var json = JSON.parse(data); var json = JSON.parse(data);
accesstoken = json.access_token; accesstoken = json.access_token;
const options = { const options_textcard = {
url: `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${accesstoken}`,
json: {
touser:`${QYWX_AM_AY[2]}`,
agentid:`${QYWX_AM_AY[3]}`,
msgtype: 'textcard',
textcard: {
title: `${text}`,
description: `${desp}`,
url: '127.0.0.1',
btntxt: '更多'
},
safe:'0',
},
headers: {
'Content-Type': 'application/json',
},
};
const options_mpnews = {
url: `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${accesstoken}`, url: `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${accesstoken}`,
json: { json: {
touser:`${QYWX_AM_AY[2]}`, touser:`${QYWX_AM_AY[2]}`,
@@ -446,7 +470,7 @@ function qywxamNotify(text, desp) {
thumb_media_id: `${QYWX_AM_AY[4]}`, thumb_media_id: `${QYWX_AM_AY[4]}`,
author : `智能助手` , author : `智能助手` ,
content_source_url: ``, content_source_url: ``,
content : `${desp}`, //暂时直接设置成了desp content : `${html}`,
digest: `${desp}` digest: `${desp}`
} }
] ]
@@ -457,7 +481,7 @@ function qywxamNotify(text, desp) {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}; };
$.post(options, (err, resp, data) => { $.post((QYWX_AM_AY[4]==0)?options_textcard:options_mpnews, (err, resp, data) => {
try { try {
if (err) { if (err) {
console.log('企业微信应用消息发送通知消息失败!!\n'); console.log('企业微信应用消息发送通知消息失败!!\n');
@@ -564,7 +588,7 @@ function pushPlusNotify(text, desp) {
} }
}) })
} else { } else {
console.log('\n您未提供push+推送所需的PUSH_PLUS_TOKEN取消push+推送消息通知\n'); console.log('您未提供push+推送所需的PUSH_PLUS_TOKEN取消push+推送消息通知\n');
resolve() resolve()
} }
}) })