JD: 1. 添加医药接口 #164 , 2. 部分接口加入崩溃自动禁用 (Beta)

例如:
首次运行VPN崩溃, 下次运行将自动禁用相关崩溃接口, 可在BoxJs重新开启.
This commit is contained in:
NobyDa 2020-08-01 20:13:37 +08:00
parent 0b6cc894f9
commit 372ad4e578
2 changed files with 77 additions and 15 deletions

View File

@ -2,7 +2,7 @@
京东多合一签到脚本
更新时间: 2020.7.29 20:50 v1.34
更新时间: 2020.8.1 19:30 v1.35 (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,7 @@ async function all() {
JingDongShake(stop) //京东摇一摇
]);
await Promise.all([
JDUserSignPre(stop, 'JDDrug', '京东商城-医药'), //京东医药馆
JDUserSignPre(stop, 'JDVege', '京东商城-菜场'), //京东菜场
JDUserSignPre(stop, 'JDFood', '京东商城-美食'), //京东美食馆
JDUserSignPre(stop, 'JDClean', '京东商城-清洁'), //京东清洁馆
@ -128,12 +129,12 @@ 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, 'JDDrug', '京东商城-医药'); //京东医药馆
await JDUserSignPre(stop, 'JDGStore', '京东商城-超市'); //京东超市
await JDUserSignPre(stop, 'JDPet', '京东商城-宠物'); //京东宠物馆
await JDFlashSale(stop); //京东闪购
@ -194,6 +195,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"
@ -787,7 +789,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',
@ -840,13 +842,16 @@ function JDUserSignPre1(s, key, title) {
//}, s)
if (out) setTimeout(reject, out + s)
}).then(data => {
disable(key, title, 2)
return JDUserSign(s, key, title, encodeURIComponent(JSON.stringify(data)));
}, () => {});
}).catch(err => {
return disable(key, title, 2)
})
}
function JDUserSignPre2(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://pro.m.jd.com/mall/active/${acData[key]}/index.html`,
@ -876,8 +881,11 @@ function JDUserSignPre2(s, key, title) {
//}, s)
if (out) setTimeout(reject, out + s)
}).then(data => {
disable(key, title, 2)
return JDUserSign(s, key, title, encodeURIComponent(data));
}, () => {});
}).catch(err => {
return disable(key, title, 2)
})
}
function JDUserSign(s, key, title, body) {
@ -1870,9 +1878,53 @@ 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" || 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
@ -1882,6 +1934,8 @@ function disable(name) {
function initial() {
acData = {
// 京东商城-医药
JDDrug: '3tqTG5sF1xCUyC6vgEF5CLCxGn7w',
// 京东商城-超市
JDGStore: 'aNCM6yrzD6qp1Vvh5YTzeJtk7cM',
// 京东商城-宠物
@ -1914,6 +1968,7 @@ function initial() {
JRDSign: {},
JDGStore: {},
JDPet: {},
JDDrug: {},
JDFSale: {},
JDBook: {},
JDShand: {},

View File

@ -10,24 +10,31 @@
"keys": ["CookieJD", "CookieJD2"],
"settings": [{
"id": "JD_DailyBonusLog",
"name": "响应日志",
"name": "详细响应日志",
"val": false,
"type": "boolean",
"desc": ""
}, {
"id": "JD_DailyBonusDisable",
"name": "签到接口启用",
"val": ["SpeedUp", "JDBean", "JRBean", "JRDoll", "JRSteel", "JDTurn", "JDGStore", "JDPet", "JDFSale", "Overseas", "JDBook", "JDShand", "JDMakeup", "JDWomen", "JDVege", "JDCash", "JDFood", "JDClean", "JDCare", "JDJewels", "JDCube", "JDPrize", "subsidy", "JDShake", "JRDSign", "Qbear", "TCash", "TSteel"],
"id": "JD_Crash_disable",
"name": "崩溃自动禁用",
"val": true,
"type": "boolean",
"desc": ""
}, {
"id": "JD_DailyBonusDisables",
"name": "签到接口禁用",
"val": "",
"type": "checkboxes",
"desc": "",
"items": [
{"key": "SpeedUp","label": "天天加速"},
{"key": "JDBean","label": "京东京豆"},
{"key": "JRBean","label": "金融京豆"},
{"key": "JRBean","label": "金融金贴"},
{"key": "JRDoll","label": "金融娃娃"},
{"key": "JRSteel","label": "金融钢镚"},
{"key": "JDTurn","label": "京东转盘"},
{"key": "JDGStore","label": "京东超市"},
{"key": "JDDrug","label": "京东医药"},
{"key": "JDPet","label": "京东宠物"},
{"key": "JDFSale","label": "京东闪购"},
{"key": "Overseas","label": "京东国际"},