luci-app-jd-dailybonus: bump to 0.8.3

This commit is contained in:
CN_SZTL 2020-08-04 22:28:39 +08:00
parent a0adaa4a38
commit 8acd2f2a2d
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
4 changed files with 266 additions and 76 deletions

View File

@ -7,8 +7,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-jd-dailybonus
LUCI_PKGARCH:=all
PKG_VERSION:=0.8.2
PKG_RELEASE:=20200719
PKG_VERSION:=0.8.3
PKG_RELEASE:=20200804
include $(INCLUDE_DIR)/package.mk

View File

@ -1,5 +1,5 @@
config global
option version '1.29'
option version '1.37'
option auto_run_time '1'
option auto_run '1'
option auto_update_time '1'

View File

@ -2,7 +2,7 @@
京东多合一签到脚本
更新时间: 2020.7.18 17:20 v1.29
更新时间: 2020.8.3 21:50 v1.37 (Beta)
有效接口: 24+
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
电报频道: @NobyDa
@ -98,9 +98,9 @@ var out = 0; //接口超时退出, 用于可能发生的网络不稳定, 0则关
var $nobyda = nobyda();
async function all() {
await JingDongSpeedUp(stop); //京东天天加速
if (stop == 0) {
await Promise.all([
JingDongSpeedUp(stop), //京东天天加速
JingDongBean(stop), //京东京豆
JingRongBean(stop), //金融京豆
JingRongDoll(stop), //金融抓娃娃
@ -115,6 +115,8 @@ async function all() {
JingDongShake(stop) //京东摇一摇
]);
await Promise.all([
JDUserSignPre(stop, 'JDClocks', '京东商城-钟表'), //京东钟表馆
JDUserSignPre(stop, 'JDDrug', '京东商城-医药'), //京东医药馆
JDUserSignPre(stop, 'JDVege', '京东商城-菜场'), //京东菜场
JDUserSignPre(stop, 'JDFood', '京东商城-美食'), //京东美食馆
JDUserSignPre(stop, 'JDClean', '京东商城-清洁'), //京东清洁馆
@ -128,12 +130,13 @@ async function all() {
JDUserSignPre(stop, 'JDMakeup', '京东商城-美妆') //京东美妆馆
]);
} else {
await JingDongSpeedUp(stop); //京东天天加速
await JingDongBean(stop); //京东京豆
await JingRongBean(stop); //金融京豆
await JingRongDoll(stop); //金融抓娃娃
await JingRongSteel(stop); //金融钢镚
await JingDongTurn(stop); //京东转盘
await JDUserSignPre(stop, 'JDClocks', '京东商城-钟表'); //京东钟表馆
await JDUserSignPre(stop, 'JDDrug', '京东商城-医药'); //京东医药馆
await JDUserSignPre(stop, 'JDGStore', '京东商城-超市'); //京东超市
await JDUserSignPre(stop, 'JDPet', '京东商城-宠物'); //京东宠物馆
await JDFlashSale(stop); //京东闪购
@ -194,6 +197,7 @@ function notify() {
var DName = merge.JDShake.nickname ? merge.JDShake.nickname : "获取失败"
var Name = add ? DualAccount ? "【签到号一】: " + DName + "\n" : "【签到号二】: " + DName + "\n" : ""
console.log("\n" + Name + one + two + three + four + notify)
move(0, 0, 1)
if ($nobyda.isJSBox) {
if (add && DualAccount) {
Shortcut = Name + one + two + three + "\n"
@ -379,11 +383,48 @@ function JingDongBean(s) {
}
function JingDongTurn(s) {
return new Promise((resolve, reject) => {
if (disable("JDTurn")) return reject()
const JDTUrl = {
url: 'https://api.m.jd.com/client.action?functionId=wheelSurfIndex&body=%7B%22actId%22%3A%22jgpqtzjhvaoym%22%2C%22appSource%22%3A%22jdhome%22%7D&appid=ld',
headers: {
Cookie: KEY,
}
};
$nobyda.get(JDTUrl, async function(error, response, data) {
try {
if (error) {
merge.JDTurn.notify = "京东商城-转盘: 登录接口请求失败 ‼️‼️"
merge.JDTurn.fail = 1
} else {
const cc = JSON.parse(data).data.lotteryCode
const Details = LogDetails ? "response:\n" + data : '';
if (cc) {
console.log("\n" + "京东商城-转盘查询成功 " + Details)
return resolve(cc)
} else {
merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 查询错误 ⚠️"
merge.JDTurn.fail = 1
console.log("\n" + "京东商城-转盘查询失败 " + Details)
}
}
} catch (eor) {
$nobyda.notify("京东转盘-登录" + eor.name + "‼️", JSON.stringify(eor), eor.message)
} finally {
reject()
}
})
if (out) setTimeout(reject, out + s)
}).then(data => {
return JingDongTurnSign(s, data);
}, () => {});
}
function JingDongTurnSign(s, code) {
return new Promise(resolve => {
if (disable("JDTurn")) return resolve()
setTimeout(() => {
const JDTUrl = {
url: 'https://api.m.jd.com/client.action?functionId=lotteryDraw&body=%7B%22actId%22%3A%22jgpqtzjhvaoym%22%2C%22appSource%22%3A%22jdhome%22%2C%22lotteryCode%22%3A%224wwzdq7wkqx2usx4g5i2nu5ho4auto4qxylblkxacm7jqdsltsepmgpn3b2hgyd7hiawzpccizuck%22%7D&appid=ld',
url: `https://api.m.jd.com/client.action?functionId=lotteryDraw&body=%7B%22actId%22%3A%22jgpqtzjhvaoym%22%2C%22appSource%22%3A%22jdhome%22%2C%22lotteryCode%22%3A%22${code}%22%7D&appid=ld`,
headers: {
Cookie: KEY,
}
@ -411,7 +452,7 @@ function JingDongTurn(s) {
merge.JDTurn.success += 1
merge.JDTurn.bean += Number(cc.data.prizeSendNumber)
if (cc.data.chances != "0") {
await JingDongTurn(2000)
await JingDongTurnSign(2000, code)
}
} else {
console.log("\n" + "京东商城-转盘签到失败 " + Details)
@ -419,7 +460,7 @@ function JingDongTurn(s) {
merge.JDTurn.notify += merge.JDTurn.notify ? "\n京东商城-转盘: 成功, 状态: 未中奖 🐶 (多次)" : "京东商城-转盘: 成功, 状态: 未中奖 🐶"
merge.JDTurn.success += 1
if (cc.data.chances != "0") {
await JingDongTurn(2000)
await JingDongTurnSign(2000, code)
}
} else if (data.match(/(T215|次数为0)/)) {
merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 已转过 ⚠️"
@ -462,26 +503,26 @@ function JingRongBean(s) {
$nobyda.post(login, async function(error, response, data) {
try {
if (error) {
merge.JRBean.notify = "京东金融-京豆: 登录接口请求失败 ‼️‼️"
merge.JRBean.notify = "京东金融-金贴: 登录接口请求失败 ‼️‼️"
merge.JRBean.fail = 1
} else {
const Details = LogDetails ? "response:\n" + data : '';
if (data.match(/\"login\":true/)) {
console.log("\n" + "京东金融-京豆登录成功 " + Details)
console.log("\n" + "京东金融-金贴登录成功 " + Details)
await JRBeanCheckin(200)
} else {
console.log("\n" + "京东金融-京豆登录失败 " + Details)
console.log("\n" + "京东金融-金贴登录失败 " + Details)
if (data.match(/\"login\":false/)) {
merge.JRBean.notify = "京东金融-京豆: 失败, 原因: Cookie失效‼"
merge.JRBean.notify = "京东金融-金贴: 失败, 原因: Cookie失效‼"
merge.JRBean.fail = 1
} else {
merge.JRBean.notify = "京东金融-京豆: 登录接口需修正 ‼️‼️"
merge.JRBean.notify = "京东金融-金贴: 登录接口需修正 ‼️‼️"
merge.JRBean.fail = 1
}
}
}
} catch (eor) {
$nobyda.notify("京东金融-京豆登录" + eor.name + "‼️", JSON.stringify(eor), eor.message)
$nobyda.notify("京东金融-金贴登录" + eor.name + "‼️", JSON.stringify(eor), eor.message)
} finally {
resolve()
}
@ -506,39 +547,39 @@ function JRBeanCheckin(s) {
$nobyda.post(JRBUrl, function(error, response, data) {
try {
if (error) {
merge.JRBean.notify = "京东金融-京豆: 签到接口请求失败 ‼️‼️"
merge.JRBean.notify = "京东金融-金贴: 签到接口请求失败 ‼️‼️"
merge.JRBean.fail = 1
} else {
const c = JSON.parse(data)
const Details = LogDetails ? "response:\n" + data : '';
if (data.match(/\"resultCode\":\"00000\"/)) {
console.log("\n" + "京东金融-京豆签到成功 " + Details)
console.log("\n" + "京东金融-金贴签到成功 " + Details)
if (c.resultData.data.rewardAmount != "0") {
merge.JRBean.notify = "京东金融-京豆: 成功, 明细: " + c.resultData.data.rewardAmount + "京豆 🐶"
merge.JRBean.notify = "京东金融-金贴: 成功, 明细: " + c.resultData.data.rewardAmount + "金贴 💰"
merge.JRBean.success = 1
merge.JRBean.bean = c.resultData.data.rewardAmount
//merge.JRBean.bean = c.resultData.data.rewardAmount
} else {
merge.JRBean.notify = "京东金融-京豆: 成功, 明细: 无奖励 🐶"
merge.JRBean.notify = "京东金融-金贴: 成功, 明细: 无奖励 🐶"
merge.JRBean.success = 1
}
} else {
console.log("\n" + "京东金融-京豆签到失败 " + Details)
console.log("\n" + "京东金融-金贴签到失败 " + Details)
if (data.match(/(发放失败|70111)/)) {
merge.JRBean.notify = "京东金融-京豆: 失败, 原因: 已签过 ⚠️"
merge.JRBean.notify = "京东金融-金贴: 失败, 原因: 已签过 ⚠️"
merge.JRBean.fail = 1
} else {
if (data.match(/(\"resultCode\":3|请先登录)/)) {
merge.JRBean.notify = "京东金融-京豆: 失败, 原因: Cookie失效‼"
merge.JRBean.notify = "京东金融-金贴: 失败, 原因: Cookie失效‼"
merge.JRBean.fail = 1
} else {
merge.JRBean.notify = "京东金融-京豆: 失败, 原因: 未知 ⚠️"
merge.JRBean.notify = "京东金融-金贴: 失败, 原因: 未知 ⚠️"
merge.JRBean.fail = 1
}
}
}
}
} catch (eor) {
$nobyda.notify("京东金融-京豆" + eor.name + "‼️", JSON.stringify(eor), eor.message)
$nobyda.notify("京东金融-金贴" + eor.name + "‼️", JSON.stringify(eor), eor.message)
} finally {
resolve()
}
@ -750,7 +791,7 @@ function JDUserSignPre(s, key, title) {
function JDUserSignPre1(s, key, title) {
return new Promise((resolve, reject) => {
if (disable(key)) return reject()
if (disable(key, title, 1)) return reject()
//setTimeout(() => {
const JDUrl = {
url: 'https://api.m.jd.com/?client=wh5&functionId=qryH5BabelFloors',
@ -766,6 +807,7 @@ function JDUserSignPre1(s, key, title) {
merge[key].notify = `${title}: 签到活动获取失败 ‼️‼️`
merge[key].fail = 1
} else {
const turnTableId = data.match(/\"turnTableId\":\"(\d+)\"/)
if (data.match(/enActK/)) { // 含有签到活动数据
const od = JSON.parse(data);
let params = (od.floatLayerList || []).filter(o => o.params && o.params.match(/enActK/)).map(o => o.params).pop();
@ -790,41 +832,8 @@ function JDUserSignPre1(s, key, title) {
}); // 执行签到处理
return;
}
}
merge[key].notify = `${title}: 失败, 原因: 不含活动数据 ⚠️`
merge[key].fail = 1
}
} catch (eor) {
$nobyda.notify(`${title}${eor.name} ‼️`, JSON.stringify(eor), eor.message)
} finally {
reject()
}
})
//}, s)
if (out) setTimeout(reject, out + s)
}).then(data => {
return JDUserSign(s, key, title, encodeURIComponent(JSON.stringify(data)));
}, () => {});
}
function JDUserSignPre2(s, key, title) {
return new Promise((resolve, reject) => {
if (disable(key)) return reject()
//setTimeout(() => {
const JDUrl = {
url: `https://pro.m.jd.com/mall/active/${acData[key]}/index.html`,
headers: {
Cookie: KEY,
}
};
$nobyda.get(JDUrl, function(error, response, data) {
try {
if (error) {
merge[key].notify = `${title}: 签到活动获取失败 ‼️‼️`
merge[key].fail = 1
} else {
if (data.match(/"params":"{\\"enActK\\".*?\\"}"/)) { // 含有签到活动数据
resolve(`{${data.match(/"params":"{\\"enActK\\".*?\\"}"/)}}`); // 执行签到处理
} else if (turnTableId) {
reject(turnTableId[1])
return;
}
merge[key].notify = `${title}: 失败, 原因: 不含活动数据 ⚠️`
@ -839,11 +848,59 @@ function JDUserSignPre2(s, key, title) {
//}, s)
if (out) setTimeout(reject, out + s)
}).then(data => {
return JDUserSign(s, key, title, encodeURIComponent(data));
}, () => {});
disable(key, title, 2)
return JDUserSign1(s, key, title, encodeURIComponent(JSON.stringify(data)));
}).catch(err => {
disable(key, title, 2)
if (err) return JDUserSign2(s, key, title, err)
})
}
function JDUserSign(s, key, title, body) {
function JDUserSignPre2(s, key, title) {
return new Promise((resolve, reject) => {
if (disable(key, title, 1)) return reject()
//setTimeout(() => {
const JDUrl = {
url: `https://pro.m.jd.com/mall/active/${acData[key]}/index.html`,
headers: {
Cookie: KEY,
}
};
$nobyda.get(JDUrl, function(error, response, data) {
try {
if (error) {
merge[key].notify = `${title}: 签到活动获取失败 ‼️‼️`
merge[key].fail = 1
} else {
const turnTable = data.match(/\"turnTableId\":\"(\d+)\"/)
if (data.match(/"params":"{\\"enActK\\".*?\\"}"/)) { // 含有签到活动数据
resolve(`{${data.match(/"params":"{\\"enActK\\".*?\\"}"/)}}`); // 执行签到处理
return;
} else if (turnTable) {
reject(turnTable[1])
return;
}
merge[key].notify = `${title}: 失败, 原因: 不含活动数据 ⚠️`
merge[key].fail = 1
}
} catch (eor) {
$nobyda.notify(`${title}${eor.name} ‼️`, JSON.stringify(eor), eor.message)
} finally {
reject()
}
})
//}, s)
if (out) setTimeout(reject, out + s)
}).then(data => {
disable(key, title, 2)
return JDUserSign1(s, key, title, encodeURIComponent(data));
}).catch(err => {
disable(key, title, 2)
if (err) return JDUserSign2(s, key, title, err)
})
}
function JDUserSign1(s, key, title, body) {
return new Promise(resolve => {
setTimeout(() => {
const JDUrl = {
@ -863,7 +920,7 @@ function JDUserSign(s, key, title, body) {
const Details = LogDetails ? `response:\n${data}` : '';
const cc = JSON.parse(data)
if (data.match(/签到成功/)) {
console.log(`\n${title}签到成功${Details}`)
console.log(`\n${title}签到成功(1)${Details}`)
if (data.match(/(\"text\":\"\d+京豆\")/)) {
let beanQuantity = cc.awardList[0].text.match(/\d+/)
merge[key].notify = `${title}: 成功, 明细: ${beanQuantity}京豆 🐶`
@ -874,7 +931,7 @@ function JDUserSign(s, key, title, body) {
merge[key].success = 1
}
} else {
console.log(`\n${title}签到失败 ${Details}`)
console.log(`\n${title}签到失败(1)${Details}`)
if (data.match(/(已签到|已领取)/)) {
merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️`
merge[key].fail = 1
@ -905,6 +962,59 @@ function JDUserSign(s, key, title, body) {
});
}
function JDUserSign2(s, key, title, tid) {
return new Promise(resolve => {
setTimeout(() => {
const JDUrl = {
url: 'https://jdjoy.jd.com/api/turncard/channel/sign',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Cookie: KEY,
},
body: `turnTableId=${tid}`
};
$nobyda.post(JDUrl, function(error, response, data) {
try {
if (error) {
merge[key].notify = `${title}: 签到接口请求失败 ‼️‼️`
merge[key].fail = 1
} else {
const Details = LogDetails ? `response:\n${data}` : '';
const cc = JSON.parse(data)
if (cc.success == true) {
console.log(`\n${title}签到成功(2)${Details}`)
if (data.match(/\"jdBeanQuantity\":\d+/)) {
merge[key].notify = `${title}: 成功, 明细: ${cc.data.jdBeanQuantity}京豆 🐶`
merge[key].bean = cc.data.jdBeanQuantity
} else {
merge[key].notify = `${title}: 成功, 明细: 无京豆 🐶`
}
merge[key].success = 1
} else {
console.log(`\n${title}签到失败(2)${Details}`)
if (data.match(/(已经签到|已经领取)/)) {
merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️`
} else if (data.match(/(不存在|已结束|未开始)/)) {
merge[key].notify = `${title}: 失败, 原因: 活动已结束 ⚠️`
} else if (data.match(/(没有登录|B0001)/)) {
merge[key].notify = `${title}: 失败, 原因: Cookie失效‼`
} else {
merge[key].notify = `${title}: 失败, 原因: 未知 ⚠️`
}
merge[key].fail = 1
}
}
} catch (eor) {
$nobyda.notify(`${title}${eor.name} ‼️`, JSON.stringify(eor), eor.message)
} finally {
resolve()
}
})
}, s)
if (out) setTimeout(resolve, out + s)
});
}
function JDFlashSale(s) {
return new Promise(resolve => {
if (disable("JDFSale")) return resolve()
@ -1092,11 +1202,40 @@ function JingDongCash(s) {
}
function JDMagicCube(s) {
return new Promise((resolve, reject) => {
if (disable("JDCube")) return reject()
const JDUrl = {
url: 'https://api.m.jd.com/client.action?functionId=getNewsInteractionInfo&appid=smfe',
headers: {
Cookie: KEY,
}
};
$nobyda.get(JDUrl, function(error, response, data) {
try {
if (!error && data.match(/\"interactionId\":\d+/)) {
const Details = LogDetails ? "response:\n" + data : '';
merge.JDCube.key = data.match(/\"interactionId\":(\d+)/)[1]
console.log("\n京东魔方-查询活动成功 " + Details)
} else {
console.log("\n京东魔方-查询活动失败 ")
}
} catch (eor) {
$nobyda.notify("京东魔方-查询" + eor.name + "‼️", JSON.stringify(eor), eor.message)
} finally {
resolve(merge.JDCube.key)
}
})
if (out) setTimeout(reject, out + s)
}).then(data => {
return JDMagicCubeSign(s, data)
}, () => {});
}
function JDMagicCubeSign(s, id) {
return new Promise(resolve => {
if (disable("JDCube")) return resolve()
setTimeout(() => {
const JDMCUrl = {
url: 'https://api.m.jd.com/client.action?functionId=getNewsInteractionLotteryInfo&appid=smfe',
url: `https://api.m.jd.com/client.action?functionId=getNewsInteractionLotteryInfo&appid=smfe${id ? `&body=%7B%22interactionId%22%3A${id}%7D` : ``}`,
headers: {
Cookie: KEY,
}
@ -1400,9 +1539,9 @@ function JDReceiveTask(s, CID) {
Cookie: KEY
}
};
count += 1
$nobyda.get(TUrl, function(error, response, data) {
try {
count++
if (error) {
console.log("\n天天加速-领取道具请求失败 ‼️‼️")
} else {
@ -1495,9 +1634,9 @@ function JDUseProps(s, PropID) {
Cookie: KEY
}
};
PropCount += 1
$nobyda.get(PropUrl, function(error, response, data) {
try {
PropCount++
if (error) {
console.log("\n天天加速-使用道具请求失败 ‼️‼️")
} else {
@ -1804,17 +1943,66 @@ function TotalCash() {
});
}
function disable(name) {
const read = $nobyda.read("JD_DailyBonusDisable")
if (read === "" || read && read.indexOf(name) == -1) {
function disable(Val, name, way) {
const read = $nobyda.read("JD_DailyBonusDisables")
const annal = $nobyda.read("JD_Crash_" + Val)
const boxds = $nobyda.read("JD_Crash_disable") === "false" ? false : true
const old = (Val == "JDDrug" || Val == "JDClocks" || way == 2) ? false : move(Val, read, 0)
if (annal && way == 1 && boxds) {
var Crash = $nobyda.write("", "JD_Crash_" + Val)
if (read) {
if (read.indexOf(Val) == -1) {
var Crash = $nobyda.write(`${read},${Val}`, "JD_DailyBonusDisables")
$nobyda.notify("京东签到 ⚠️", "", `检测到上次执行"${name}"意外崩溃\n已为您自动禁用该接口, 如需开启请前往BoxJs`)
}
} else {
var Crash = $nobyda.write(Val, "JD_DailyBonusDisables")
$nobyda.notify("京东签到 ⚠️", "", `检测到上次执行"${name}"意外崩溃\n已为您自动禁用该接口, 如需开启请前往BoxJs`)
}
return true
} else if (way == 1 && boxds) {
var Crash = $nobyda.write(name, "JD_Crash_" + Val)
} else if (way == 2 && annal) {
var Crash = $nobyda.write("", "JD_Crash_" + Val)
}
if (read && read.indexOf(Val) != -1 || old) {
return true
} else {
return false
}
}
function move(ValKey, NewKey, DelOld) {
const OldKey = $nobyda.read("JD_DailyBonusDisable")
if (DelOld && OldKey) {
if (OldKey.split(",").length != 28) {
$nobyda.notify("京东签到", "BoxJs禁用迁移成功", "请更新京东BoxJs订阅以适配新版本")
}
var Crash = $nobyda.write("", "JD_DailyBonusDisable")
return true
}
if (OldKey && OldKey.indexOf(ValKey) == -1) {
console.log(`\nBoxJs禁用迁移成功 (${ValKey})`)
if (NewKey) {
if (NewKey.indexOf(ValKey) == -1) {
var Crash = $nobyda.write(`${NewKey},${ValKey}`, "JD_DailyBonusDisables")
}
} else {
var Crash = $nobyda.write(ValKey, "JD_DailyBonusDisables")
}
return true
} else {
return false
}
}
function initial() {
acData = {
// 京东商城-钟表
JDClocks: '2BcJPCVVzMEtMUynXkPscCSsx68W',
// 京东商城-医药
JDDrug: '3tqTG5sF1xCUyC6vgEF5CLCxGn7w',
// 京东商城-超市
JDGStore: 'aNCM6yrzD6qp1Vvh5YTzeJtk7cM',
// 京东商城-宠物
@ -1843,11 +2031,12 @@ function initial() {
SpeedUp: {},
JDBean: {},
JDTurn: {},
JRBean: {},
JRDoll: {},
JRDSign: {},
JDGStore: {},
JDPet: {},
JDDrug: {},
JDClocks: {},
JDFSale: {},
JDBook: {},
JDShand: {},
@ -1862,6 +2051,7 @@ function initial() {
JDCube: {},
JDPrize: {},
JRSteel: {},
JRBean: {},
subsidy: {},
JDCash: {},
JDShake: {}

View File

@ -77,7 +77,7 @@ fill_cookie() {
fi
}
remote_ver=$(cat $TEMP_SCRIPT | sed -n '/更新时间/p' | awk '{print $NF}' | sed 's/v//')
remote_ver=$(cat $TEMP_SCRIPT | sed -n '/更新时间/p' | awk '{for (i=1;i<=NF;i++){if ($i ~/v/) {print $i}}}' | sed 's/v//')
local_ver=$(uci_get_by_type global version)
add_cron() {