diff --git a/package/ctcgfw/luci-app-jd-dailybonus/Makefile b/package/ctcgfw/luci-app-jd-dailybonus/Makefile index 17c8f546a5..bf7b39379b 100644 --- a/package/ctcgfw/luci-app-jd-dailybonus/Makefile +++ b/package/ctcgfw/luci-app-jd-dailybonus/Makefile @@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-jd-dailybonus LUCI_PKGARCH:=all -PKG_VERSION:=0.8.4 -PKG_RELEASE:=20200826 +PKG_VERSION:=0.8.6 +PKG_RELEASE:=20201021 include $(INCLUDE_DIR)/package.mk diff --git a/package/ctcgfw/luci-app-jd-dailybonus/luasrc/model/cbi/jd-dailybonus/client.lua b/package/ctcgfw/luci-app-jd-dailybonus/luasrc/model/cbi/jd-dailybonus/client.lua index 46295dee7c..72a252472f 100644 --- a/package/ctcgfw/luci-app-jd-dailybonus/luasrc/model/cbi/jd-dailybonus/client.lua +++ b/package/ctcgfw/luci-app-jd-dailybonus/luasrc/model/cbi/jd-dailybonus/client.lua @@ -14,7 +14,7 @@ o.rawhtml = true o.template = "jd-dailybonus/cookie_tools" o = s:option(ListValue, "remote_url", translate("Source Update Url")) -o:value("https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js", translate("GitHub")) +o:value("https://cdn.jsdelivr.net/gh/NobyDa/Script/JD-DailyBonus/JD_DailyBonus.js", translate("GitHub")) o:value("https://gitee.com/jerrykuku/staff/raw/master/JD_DailyBonus.js", translate("Gitee")) o.default = "nil" o.rmempty = false @@ -33,6 +33,13 @@ o.default = 0 o.datatype = integer o.description = translate("自定义延迟签到,单位毫秒. 默认分批并发无延迟. (延迟作用于每个签到接口, 如填入延迟则切换顺序签到. ) ") +o = s:option(ListValue, "serverurl", translate("ServerURL")) +o:value("scu", translate("SCU")) +o:value("sct", translate("SCT")) +o.default = "scu" +o.rmempty = false +o.description = translate('选择Server酱的推送接口') + o = s:option(Value, "serverchan", translate("ServerChan SCKEY")) o.rmempty = true o.description = translate("微信推送,基于Server酱服务,请自行登录 http://sc.ftqq.com/ 绑定并获取 SCKEY (仅在自动签到时推送)") @@ -65,4 +72,4 @@ o = s:option(DummyValue, "", "") o.rawhtml = true o.version = sys.exec('uci get jd-dailybonus.@global[0].version') o.template = "jd-dailybonus/update_service" -return m \ No newline at end of file +return m diff --git a/package/ctcgfw/luci-app-jd-dailybonus/po/zh-cn/jd-dailybonus.po b/package/ctcgfw/luci-app-jd-dailybonus/po/zh-cn/jd-dailybonus.po index cfb449a0f4..e58389ae04 100644 --- a/package/ctcgfw/luci-app-jd-dailybonus/po/zh-cn/jd-dailybonus.po +++ b/package/ctcgfw/luci-app-jd-dailybonus/po/zh-cn/jd-dailybonus.po @@ -55,10 +55,18 @@ msgstr "延迟签到" msgid "ServerChan SCKEY" msgstr "Server酱 SCKEY" +msgid "ServerURL" +msgstr "Server酱的推送接口地址" + +msgid "SCT" +msgstr "测试版推送接口地址" + +msgid "SCU" +msgstr "原版推送接口地址" + msgid "Failed Push" msgstr "失效时推送" - msgid "Auto Run" msgstr "自动签到" diff --git a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/JD_DailyBonus.js b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/JD_DailyBonus.js index a525fb7200..698004d5a1 100644 --- a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/JD_DailyBonus.js +++ b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/JD_DailyBonus.js @@ -2,8 +2,8 @@ 京东多合一签到脚本 -更新时间: 2020.8.23 16:30 v1.47 (Beta) -有效接口: 29+ +更新时间: 2020.9.28 18:00 v1.65 +有效接口: 35+ 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 电报频道: @NobyDa 问题反馈: @NobyDa_bot @@ -24,6 +24,7 @@ var DualKey = ''; //如需双账号签到,此处单引号内填写抓取的"账 注3: 如果复制的Cookie开头为"Cookie: "请把它删除后填入. 注4: 如果使用QX,Surge,Loon并获取Cookie后, 再重复填写以上选项, 则签到优先读取以上Cookie. 注5: 如果使用Node.js, 需自行安装'request'模块. 例: npm install request -g + 注6: Node.js或JSbox环境下已配置数据持久化, 填写Cookie运行一次后, 后续更新脚本无需再次填写, 待Cookie失效后重新抓取填写即可. ************************* 【 QX, Surge, Loon 说明 】 : @@ -69,18 +70,18 @@ http-request https:\/\/api\.m\.jd\.com\/client\.action.*functionId=signBean tag= hostname = api.m.jd.com ************************* -【 QX 1.0.5+ 脚本配置 】 : +【 QX 1.0.10+ 脚本配置 】 : ************************* [task_local] # 京东多合一签到 -# 注意此为本地路径, 请根据实际情况自行调整 -5 0 * * * JD_DailyBonus.js +# 注意此为远程路径, 低版本用户请自行调整为本地路径. +5 0 * * * https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js, tag=京东多合一签到, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png,enabled=true [rewrite_local] # 获取京东Cookie. -# 注意此为本地路径, 请根据实际情况自行调整. -https:\/\/api\.m\.jd\.com\/client\.action.*functionId=signBean url script-request-header JD_DailyBonus.js +# 注意此为远程路径, 低版本用户请自行调整为本地路径. +https:\/\/api\.m\.jd\.com\/client\.action.*functionId=signBean url script-request-header https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js [mitm] hostname = api.m.jd.com @@ -91,7 +92,7 @@ var LogDetails = false; //是否开启响应日志, true则开启 var stop = 0; //自定义延迟签到,单位毫秒. 默认分批并发无延迟. 延迟作用于每个签到接口, 如填入延迟则切换顺序签到(耗时较长), VPN重启或越狱用户建议填写1, Surge用户请注意在SurgeUI界面调整脚本超时 -var DeleteCookie = false; //是否清除Cookie, true则开启. (该选项仅适用于QX,Surge,Loon,JsBox) +var DeleteCookie = false; //是否清除Cookie, true则开启. var boxdis = true; //是否开启自动禁用, false则关闭. 脚本运行崩溃时(如VPN断连), 下次运行时将自动禁用相关崩溃接口(仅部分接口启用), 崩溃时可能会误禁用正常接口. (该选项仅适用于QX,Surge,Loon) @@ -105,7 +106,10 @@ async function all() { if (stop == 0) { await Promise.all([ JingDongBean(stop), //京东京豆 - JingRongBean(stop), //金融京豆 + JDTakeaLook(stop), //京东发现-看一看 + JingDongStore(stop), //京东超市 + JingDongWebcasts(stop), //京东直播 + JingRongBean(stop), //金融简单赚钱 JingRongDoll(stop), //金融抓娃娃 JingRongSteel(stop), //金融钢镚 JingDongTurn(stop), //京东转盘 @@ -119,16 +123,19 @@ async function all() { JingDongShake(stop) //京东摇一摇 ]); await Promise.all([ - JDUserSignPre(stop, 'JDTreasure', '京东商城-夺宝'), //京东夺宝岛 + JDUserSignPre(stop, 'JDShoes', '京东商城-鞋靴'), //京东鞋靴 + JDUserSignPre(stop, 'JDEsports', '京东商城-电竞'), //京东电竞 + JDUserSignPre(stop, 'JDCalendar', '京东日历-翻牌'), //京东日历翻牌 + JDUserSignPre(stop, 'JDChild', '京东商城-童装'), //京东童装馆 JDUserSignPre(stop, 'JDBaby', '京东商城-母婴'), //京东母婴馆 JDUserSignPre(stop, 'JD3C', '京东商城-数码'), //京东数码电器馆 JDUserSignPre(stop, 'JDSubsidy', '京东晚市-补贴'), //京东晚市补贴金 JDUserSignPre(stop, 'JDDrug', '京东商城-医药'), //京东医药馆 JDUserSignPre(stop, 'JDWomen', '京东商城-女装'), //京东女装馆 - JDUserSignPre(stop, 'JDGStore', '京东商城-超市'), //京东超市 JDUserSignPre(stop, 'JDBook', '京东商城-图书') //京东图书 ]); await Promise.all([ + JDUserSignPre(stop, 'JDSchool', '京东商城-校园'), //京东校园 JDUserSignPre(stop, 'JDPet', '京东商城-宠物'), //京东宠物馆 JDUserSignPre(stop, 'JDShand', '京东拍拍-二手'), //京东拍拍二手 JDUserSignPre(stop, 'JDClean', '京东商城-清洁'), //京东清洁馆 @@ -141,7 +148,10 @@ async function all() { ]); } else { await JingDongBean(stop); //京东京豆 - await JingRongBean(stop); //金融京豆 + await JDTakeaLook(stop); //京东发现-看一看 + await JingDongStore(stop); //京东超市 + await JingDongWebcasts(stop); //京东直播 + await JingRongBean(stop); //金融简单赚钱 await JingRongDoll(stop); //金融抓娃娃 await JingRongSteel(stop); //金融钢镚 await JingDongTurn(stop); //京东转盘 @@ -152,14 +162,17 @@ async function all() { await JingDongGetCash(stop); //京东领现金 await JingDongPrize(stop); //京东抽大奖 await JingDongSubsidy(stop); //京东金贴 - await JingDongShake(stop) //京东摇一摇 - await JDUserSignPre(stop, 'JDTreasure', '京东商城-夺宝'); //京东夺宝岛 + await JingDongShake(stop); //京东摇一摇 + await JDUserSignPre(stop, 'JDSchool', '京东商城-校园'); //京东校园 + await JDUserSignPre(stop, 'JDShoes', '京东商城-鞋靴'); //京东鞋靴 + await JDUserSignPre(stop, 'JDEsports', '京东商城-电竞'); //京东电竞 + await JDUserSignPre(stop, 'JDCalendar', '京东日历-翻牌'); //京东日历翻牌 + await JDUserSignPre(stop, 'JDChild', '京东商城-童装'); //京东童装馆 await JDUserSignPre(stop, 'JDBaby', '京东商城-母婴'); //京东母婴馆 await JDUserSignPre(stop, 'JD3C', '京东商城-数码'); //京东数码电器馆 await JDUserSignPre(stop, 'JDSubsidy', '京东晚市-补贴'); //京东晚市补贴金 await JDUserSignPre(stop, 'JDClocks', '京东商城-钟表'); //京东钟表馆 await JDUserSignPre(stop, 'JDDrug', '京东商城-医药'); //京东医药馆 - await JDUserSignPre(stop, 'JDGStore', '京东商城-超市'); //京东超市 await JDUserSignPre(stop, 'JDPet', '京东商城-宠物'); //京东宠物馆 await JDUserSignPre(stop, 'JDBook', '京东商城-图书'); //京东图书 await JDUserSignPre(stop, 'JDShand', '京东拍拍-二手'); //京东拍拍二手 @@ -246,19 +259,12 @@ function notify() { function ReadCookie() { initial() DualAccount = true; + const EnvInfo = $nobyda.isJSBox ? "JD_Cookie" : "CookieJD" + const EnvInfo2 = $nobyda.isJSBox ? "JD_Cookie2" : "CookieJD2" if (DeleteCookie) { - if ($nobyda.isJSBox) { - if ($file.exists("shared://JD_Cookie.txt")) { - if ($file.exists("shared://JD_Cookie2.txt")) { - $file.delete("shared://JD_Cookie2.txt") - } - $file.delete("shared://JD_Cookie.txt") - $nobyda.notify("京东Cookie清除成功 !", "", '请手动关闭脚本内"DeleteCookie"选项') - return - } - } else if ($nobyda.read("CookieJD")) { - $nobyda.write("", "CookieJD") - $nobyda.write("", "CookieJD2") + if ($nobyda.read(EnvInfo) || $nobyda.read(EnvInfo2)) { + $nobyda.write("", EnvInfo) + $nobyda.write("", EnvInfo2) $nobyda.notify("京东Cookie清除成功 !", "", '请手动关闭脚本内"DeleteCookie"选项') $nobyda.done() return @@ -270,38 +276,17 @@ function ReadCookie() { GetCookie() return } - if ($nobyda.isJSBox) { - add = DualKey || $file.exists("shared://JD_Cookie2.txt") ? true : false - if (DualKey) { - $file.write({ - data: $data({ - string: DualKey - }), - path: "shared://JD_Cookie2.txt" - }) + if (Key || $nobyda.read(EnvInfo)) { + if ($nobyda.isJSBox || $nobyda.isNode) { + if (Key) $nobyda.write(Key, EnvInfo); + if (DualKey) $nobyda.write(DualKey, EnvInfo2); } - if (Key) { - $file.write({ - data: $data({ - string: Key - }), - path: "shared://JD_Cookie.txt" - }) - KEY = Key - all() - } else if ($file.exists("shared://JD_Cookie.txt")) { - KEY = $file.read("shared://JD_Cookie.txt").string - all() - } else { - $nobyda.notify("京东签到", "", "脚本终止, 未填写Cookie ‼️") - } - } else if (Key || $nobyda.read("CookieJD")) { - add = DualKey || $nobyda.read("CookieJD2") ? true : false - KEY = Key ? Key : $nobyda.read("CookieJD") + add = DualKey || $nobyda.read(EnvInfo2) ? true : false + KEY = Key ? Key : $nobyda.read(EnvInfo) out = parseInt($nobyda.read("JD_DailyBonusTimeOut")) || out stop = parseInt($nobyda.read("JD_DailyBonusDelay")) || stop - boxdis = $nobyda.read("JD_Crash_disable") === "false" ? false : boxdis - LogDetails = $nobyda.read("JD_DailyBonusLog") === "true" ? true : LogDetails + boxdis = $nobyda.read("JD_Crash_disable") === "false" || $nobyda.isNode || $nobyda.isJSBox ? false : boxdis + LogDetails = $nobyda.read("JD_DailyBonusLog") === "true" || LogDetails ReDis = ReDis ? $nobyda.write("", "JD_DailyBonusDisables") : "" all() } else { @@ -314,15 +299,8 @@ function double() { initial() add = true DualAccount = false - if ($nobyda.isJSBox) { - if (DualKey || $file.exists("shared://JD_Cookie2.txt")) { - KEY = DualKey ? DualKey : $file.read("shared://JD_Cookie2.txt").string - all() - } else { - $nobyda.time(); - } - } else if (DualKey || $nobyda.read("CookieJD2")) { - KEY = DualKey ? DualKey : $nobyda.read("CookieJD2") + if (DualKey || $nobyda.read($nobyda.isJSBox ? "JD_Cookie2" : "CookieJD2")) { + KEY = DualKey ? DualKey : $nobyda.read($nobyda.isJSBox ? "JD_Cookie2" : "CookieJD2") all() } else { $nobyda.time(); @@ -335,12 +313,13 @@ function JingDongBean(s) { if (disable("JDBean")) return resolve() setTimeout(() => { const JDBUrl = { - url: 'https://api.m.jd.com/client.action?functionId=signBeanIndex&appid=ld', + url: 'https://api.m.jd.com/client.action', headers: { - Cookie: KEY, - } + Cookie: KEY + }, + body: 'functionId=signBeanIndex&appid=ld' }; - $nobyda.get(JDBUrl, function(error, response, data) { + $nobyda.post(JDBUrl, function(error, response, data) { try { if (error) { throw new Error(error) @@ -446,42 +425,37 @@ function JingDongTurnSign(s, code) { } else { const cc = JSON.parse(data) const Details = LogDetails ? "response:\n" + data : ''; + const also = merge.JDTurn.notify ? true : false if (cc.code == 3) { console.log("\n" + "京东转盘Cookie失效 " + Details) merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: Cookie失效‼️" merge.JDTurn.fail = 1 + } else if (data.match(/(\"T216\"|活动结束)/)) { + merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 活动结束 ⚠️" + merge.JDTurn.fail = 1 + } else if (data.match(/(京豆|\"910582\")/)) { + console.log("\n" + "京东商城-转盘签到成功 " + Details) + merge.JDTurn.bean += Number(cc.data.prizeSendNumber) || 0 + merge.JDTurn.notify += `${also?`\n`:``}京东商城-转盘: ${also?`多次`:`成功`}, 明细: ${cc.data.prizeSendNumber||`无`}京豆 🐶` + merge.JDTurn.success += 1 + if (cc.data.chances != "0") { + await JingDongTurnSign(2000, code) + } + } else if (data.match(/未中奖/)) { + merge.JDTurn.notify += `${also?`\n`:``}京东商城-转盘: ${also?`多次`:`成功`}, 状态: 未中奖 🐶` + merge.JDTurn.success += 1 + if (cc.data.chances != "0") { + await JingDongTurnSign(2000, code) + } } else { - if (data.match(/(\"T216\"|活动结束)/)) { - merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 活动结束 ⚠️" - merge.JDTurn.fail = 1 + console.log("\n" + "京东商城-转盘签到失败 " + Details) + merge.JDTurn.fail = 1 + if (data.match(/(T215|次数为0)/)) { + merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 已转过 ⚠️" + } else if (data.match(/(T210|密码)/)) { + merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 无支付密码 ⚠️" } else { - if (data.match(/(京豆|\"910582\")/)) { - console.log("\n" + "京东商城-转盘签到成功 " + Details) - merge.JDTurn.notify += merge.JDTurn.notify ? "\n京东商城-转盘: 成功, 明细: " + cc.data.prizeSendNumber + "京豆 🐶 (多次)" : "京东商城-转盘: 成功, 明细: " + cc.data.prizeSendNumber + "京豆 🐶" - merge.JDTurn.success += 1 - merge.JDTurn.bean += Number(cc.data.prizeSendNumber) - if (cc.data.chances != "0") { - await JingDongTurnSign(2000, code) - } - } else { - console.log("\n" + "京东商城-转盘签到失败 " + Details) - if (data.match(/未中奖/)) { - merge.JDTurn.notify += merge.JDTurn.notify ? "\n京东商城-转盘: 成功, 状态: 未中奖 🐶 (多次)" : "京东商城-转盘: 成功, 状态: 未中奖 🐶" - merge.JDTurn.success += 1 - if (cc.data.chances != "0") { - await JingDongTurnSign(2000, code) - } - } else if (data.match(/(T215|次数为0)/)) { - merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 已转过 ⚠️" - merge.JDTurn.fail = 1 - } else if (data.match(/(T210|密码)/)) { - merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 无支付密码 ⚠️" - merge.JDTurn.fail = 1 - } else { - merge.JDTurn.notify += merge.JDTurn.notify ? "\n京东商城-转盘: 失败, 原因: 未知 ⚠️ (多次)" : "京东商城-转盘: 失败, 原因: 未知 ⚠️" - merge.JDTurn.fail += 1 - } - } + merge.JDTurn.notify += `${also?`\n`:``}京东商城-转盘: 失败, 原因: 未知 ⚠️${also?` (多次)`:``}` } } } @@ -501,13 +475,11 @@ function JingRongBean(s) { if (disable("JRBean")) return resolve() setTimeout(() => { const login = { - url: 'https://ms.jr.jd.com/gw/generic/zc/h5/m/signRecords', + url: 'https://ms.jr.jd.com/gw/generic/zc/h5/m/queryOpenScreenReward', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, - Referer: "https://jddx.jd.com/m/money/index.html?from=sign", + Cookie: KEY }, - body: "reqData=%7B%22bizLine%22%3A2%7D" + body: "reqData=%7B%22channelCode%22%3A%22ZHUANQIAN%22%2C%22clientType%22%3A%22sms%22%2C%22clientVersion%22%3A%2211.0%22%7D" }; $nobyda.post(login, async function(error, response, data) { try { @@ -516,21 +488,24 @@ function JingRongBean(s) { } else { const Details = LogDetails ? "response:\n" + data : ''; if (data.match(/\"login\":true/)) { - console.log("\n" + "京东金融-金贴登录成功 " + Details) - await JRBeanCheckin(200) - } else { - console.log("\n" + "京东金融-金贴登录失败 " + Details) - if (data.match(/\"login\":false/)) { - merge.JRBean.notify = "京东金融-金贴: 失败, 原因: Cookie失效‼️" - merge.JRBean.fail = 1 + console.log("\n" + "京东金融-金贴查询成功 " + Details) + const cc = JSON.parse(data) + if (cc.resultData.data.reward === false) { + await JRBeanCheckin(s, cc.resultData.data.rewardAmount); } else { - merge.JRBean.notify = "京东金融-金贴: 登录接口需修正 ‼️‼️" + const tp = cc.resultData.data.reward === true + merge.JRBean.notify = `京东金融-金贴: 失败, 原因: ${tp?`已签过`:`未知`} ⚠️` merge.JRBean.fail = 1 } + } else { + console.log("\n" + "京东金融-金贴查询失败 " + Details) + const lt = data.match(/\"login\":false/) + merge.JRBean.fail = 1 + merge.JRBean.notify = `京东金融-金贴: 失败, 原因: ${lt?`Cookie失效‼️`:`未知 ⚠️`}` } } } catch (eor) { - $nobyda.AnError("金融金贴-登录", "JRBean", eor) + $nobyda.AnError("金融金贴-查询", "JRBean", eor) } finally { resolve() } @@ -540,48 +515,35 @@ function JingRongBean(s) { }); } -function JRBeanCheckin(s) { +function JRBeanCheckin(s, amount) { return new Promise(resolve => { setTimeout(() => { const JRBUrl = { - url: 'https://ms.jr.jd.com/gw/generic/zc/h5/m/signRewardGift', + url: 'https://ms.jr.jd.com/gw/generic/zc/h5/m/openScreenReward', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, - Referer: "https://jddx.jd.com/m/jddnew/money/index.html", + Cookie: KEY }, - body: "reqData=%7B%22bizLine%22%3A2%2C%22signDate%22%3A%221%22%2C%22deviceInfo%22%3A%7B%22os%22%3A%22iOS%22%7D%2C%22clientType%22%3A%22sms%22%2C%22clientVersion%22%3A%2211.0%22%7D" + body: "reqData=%7B%22channelCode%22%3A%22ZHUANQIAN%22%2C%22clientType%22%3A%22sms%22%2C%22clientVersion%22%3A%2211.0%22%7D" }; $nobyda.post(JRBUrl, function(error, response, data) { try { if (error) { throw new Error(error) } else { - const c = JSON.parse(data) const Details = LogDetails ? "response:\n" + data : ''; - if (data.match(/\"resultCode\":\"00000\"/)) { + if (data.match(/\"rewardCode\":\"00000\"/)) { console.log("\n" + "京东金融-金贴签到成功 " + Details) - if (c.resultData.data.rewardAmount != "0") { - merge.JRBean.notify = "京东金融-金贴: 成功, 明细: " + c.resultData.data.rewardAmount + "金贴 💰" - merge.JRBean.success = 1 - //merge.JRBean.bean = c.resultData.data.rewardAmount - } else { - merge.JRBean.notify = "京东金融-金贴: 成功, 明细: 无奖励 🐶" - merge.JRBean.success = 1 - } + merge.JRBean.notify = `京东金融-金贴: 成功, 明细: ${amount || `无`}金贴 💰` + merge.JRBean.success = 1 } else { console.log("\n" + "京东金融-金贴签到失败 " + Details) - if (data.match(/发放失败|70111|10000/)) { + if (data.match(/发放失败|70111|10000|60203/)) { merge.JRBean.notify = "京东金融-金贴: 失败, 原因: 已签过 ⚠️" merge.JRBean.fail = 1 } else { - if (data.match(/(\"resultCode\":3|请先登录)/)) { - merge.JRBean.notify = "京东金融-金贴: 失败, 原因: Cookie失效‼️" - merge.JRBean.fail = 1 - } else { - merge.JRBean.notify = "京东金融-金贴: 失败, 原因: 未知 ⚠️" - merge.JRBean.fail = 1 - } + const UnType = data.match(/\"resultCode\":3|请先登录/) + merge.JRBean.notify = `京东金融-金贴: 失败, 原因: ${UnType?`Cookie失效‼️`:`未知 ⚠️`}` + merge.JRBean.fail = 1 } } } @@ -603,49 +565,32 @@ function JingRongSteel(s) { const JRSUrl = { url: 'https://ms.jr.jd.com/gw/generic/gry/h5/m/signIn', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: "reqData=%7B%22channelSource%22%3A%22JRAPP%22%2C%22riskDeviceParam%22%3A%22%7B%7D%22%7D" }; $nobyda.post(JRSUrl, function(error, response, data) { try { - if (error) { - throw new Error(error) + if (error) throw new Error(error) + const cc = JSON.parse(data) + const Details = LogDetails ? "response:\n" + data : ''; + if (data.match(/\"resBusiCode\":0/)) { + console.log("\n" + "京东金融-钢镚签到成功 " + Details) + const leng = cc.resultData.resBusiData.actualTotalRewardsValue + merge.JRSteel.steel = leng ? leng > 9 ? `0.${leng}` : `0.0${leng}` : 0 + merge.JRSteel.notify = `京东金融-钢镚: 成功, 明细: ${merge.JRSteel.steel || `无`}钢镚 💰` + merge.JRSteel.success = 1 } else { - const cc = JSON.parse(data) - const Details = LogDetails ? "response:\n" + data : ''; - if (data.match(/\"resBusiCode\":0/)) { - console.log("\n" + "京东金融-钢镚签到成功 " + Details) - const leng = "" + cc.resultData.resBusiData.actualTotalRewardsValue - if (leng.length == 1) { - merge.JRSteel.notify = "京东金融-钢镚: 成功, 明细: " + "0.0" + cc.resultData.resBusiData.actualTotalRewardsValue + "钢镚 💰" - merge.JRSteel.success = 1 - merge.JRSteel.steel = "0.0" + cc.resultData.resBusiData.actualTotalRewardsValue - } else { - merge.JRSteel.notify = "京东金融-钢镚: 成功, 明细: " + "0." + cc.resultData.resBusiData.actualTotalRewardsValue + "钢镚 💰" - merge.JRSteel.success = 1 - merge.JRSteel.steel = "0." + cc.resultData.resBusiData.actualTotalRewardsValue - } + console.log("\n" + "京东金融-钢镚签到失败 " + Details) + merge.JRSteel.fail = 1 + if (data.match(/已经领取|\"resBusiCode\":15/)) { + merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: 已签过 ⚠️" + } else if (data.match(/未实名/)) { + merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: 账号未实名 ⚠️" + } else if (data.match(/(\"resultCode\":3|请先登录)/)) { + merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: Cookie失效‼️" } else { - console.log("\n" + "京东金融-钢镚签到失败 " + Details) - if (data.match(/(已经领取|\"resBusiCode\":15)/)) { - merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: 已签过 ⚠️" - merge.JRSteel.fail = 1 - } else { - if (data.match(/未实名/)) { - merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: 账号未实名 ⚠️" - merge.JRSteel.fail = 1 - } else { - if (data.match(/(\"resultCode\":3|请先登录)/)) { - merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: Cookie失效‼️" - merge.JRSteel.fail = 1 - } else { - merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: 未知 ⚠️" - merge.JRSteel.fail = 1 - } - } - } + merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: 未知 ⚠️" } } } catch (eor) { @@ -666,8 +611,7 @@ function JRDoubleSign(s) { const JRDSUrl = { url: 'https://nu.jr.jd.com/gw/generic/jrm/h5/m/process?', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: "reqData=%7B%22actCode%22%3A%22FBBFEC496C%22%2C%22type%22%3A3%2C%22riskDeviceParam%22%3A%22%22%7D" }; @@ -732,20 +676,17 @@ function JingDongShake(s) { } else { const Details = LogDetails ? "response:\n" + data : ''; const cc = JSON.parse(data) + const also = merge.JDShake.notify ? true : false if (data.match(/prize/)) { console.log("\n" + "京东商城-摇一摇签到成功 " + Details) + merge.JDShake.success += 1 if (cc.data.prizeBean) { - merge.JDShake.notify += merge.JDShake.notify ? "\n京东商城-摇摇: 成功, 明细: " + cc.data.prizeBean.count + "京豆 🐶 (多次)" : "京东商城-摇摇: 成功, 明细: " + cc.data.prizeBean.count + "京豆 🐶" - merge.JDShake.bean += cc.data.prizeBean.count - merge.JDShake.success += 1 + merge.JDShake.bean += cc.data.prizeBean.count || 0 + merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: ${also?`多次`:`成功`}, 明细: ${merge.JDShake.bean || `无`}京豆 🐶` + } else if (cc.data.prizeCoupon) { + merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: ${also?`多次, `:``}获得满${cc.data.prizeCoupon.quota}减${cc.data.prizeCoupon.discount}优惠券→ ${cc.data.prizeCoupon.limitStr}` } else { - if (cc.data.prizeCoupon) { - merge.JDShake.notify += merge.JDShake.notify ? "\n京东商城-摇摇(多次): 获得满" + cc.data.prizeCoupon.quota + "减" + cc.data.prizeCoupon.discount + "优惠券→ " + cc.data.prizeCoupon.limitStr : "京东商城-摇摇: 获得满" + cc.data.prizeCoupon.quota + "减" + cc.data.prizeCoupon.discount + "优惠券→ " + cc.data.prizeCoupon.limitStr - merge.JDShake.success += 1 - } else { - merge.JDShake.notify += merge.JDShake.notify ? "\n京东商城-摇摇: 失败, 原因: 未知 ⚠️ (多次)" : "京东商城-摇摇: 失败, 原因: 未知 ⚠️" - merge.JDShake.fail += 1 - } + merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: 成功, 明细: 未知 ⚠️${also?` (多次)`:``}` } if (cc.data.luckyBox.freeTimes != 0) { await JingDongShake(s) @@ -753,21 +694,19 @@ function JingDongShake(s) { } else { console.log("\n" + "京东商城-摇一摇签到失败 " + Details) if (data.match(/true/)) { - merge.JDShake.notify += merge.JDShake.notify ? "\n京东商城-摇摇: 成功, 明细: 无奖励 🐶 (多次)" : "京东商城-摇摇: 成功, 明细: 无奖励 🐶" + merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: 成功, 明细: 无奖励 🐶${also?` (多次)`:``}` merge.JDShake.success += 1 if (cc.data.luckyBox.freeTimes != 0) { await JingDongShake(s) } } else { + merge.JDShake.fail = 1 if (data.match(/(无免费|8000005|9000005)/)) { merge.JDShake.notify = "京东商城-摇摇: 失败, 原因: 已摇过 ⚠️" - merge.JDShake.fail = 1 } else if (data.match(/(未登录|101)/)) { merge.JDShake.notify = "京东商城-摇摇: 失败, 原因: Cookie失效‼️" - merge.JDShake.fail = 1 } else { - merge.JDShake.notify += merge.JDShake.notify ? "\n京东商城-摇摇: 失败, 原因: 未知 ⚠️ (多次)" : "京东商城-摇摇: 失败, 原因: 未知 ⚠️" - merge.JDShake.fail += 1 + merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: 失败, 原因: 未知 ⚠️${also?` (多次)`:``}` } } } @@ -799,8 +738,7 @@ function JDUserSignPre1(s, key, title, ask) { const JDUrl = { url: 'https://api.m.jd.com/?client=wh5&functionId=qryH5BabelFloors', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: `body=${encodeURIComponent(`{"activityId":"${acData[key]}"${ask ? `,"paginationParam":"2",${ask}` : ``}}`)}` }; @@ -859,11 +797,9 @@ function JDUserSignPre1(s, key, title, ask) { merge[key].fail = 1 } } - disable(key, title, 2) reject() } catch (eor) { $nobyda.AnError(title, key, eor) - disable(key, title, 2) reject() } }) @@ -873,7 +809,7 @@ function JDUserSignPre1(s, key, title, ask) { if (typeof(data) == "object") return JDUserSign1(s, key, title, encodeURIComponent(JSON.stringify(data))); if (typeof(data) == "number") return JDUserSign2(s, key, title, data); if (typeof(data) == "string") return JDUserSignPre1(s, key, title, data); - }, () => {}) + }, () => disable(key, title, 2)) } function JDUserSignPre2(s, key, title) { @@ -918,11 +854,9 @@ function JDUserSignPre2(s, key, title) { merge[key].fail = 1 } } - disable(key, title, 2) reject() } catch (eor) { $nobyda.AnError(title, key, eor) - disable(key, title, 2) reject() } }) @@ -932,7 +866,7 @@ function JDUserSignPre2(s, key, title) { if (typeof(data) == "object") return JDUserSign1(s, key, title, encodeURIComponent(`{${data}}`)); if (typeof(data) == "number") return JDUserSign2(s, key, title, data) if (typeof(data) == "string") return JDUserSignPre1(s, key, title, data) - }, () => {}) + }, () => disable(key, title, 2)) } function JDUserSign1(s, key, title, body) { @@ -941,8 +875,7 @@ function JDUserSign1(s, key, title, body) { const JDUrl = { url: 'https://api.m.jd.com/client.action?functionId=userSign', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: `body=${body}&client=wh5` }; @@ -952,25 +885,20 @@ function JDUserSign1(s, key, title, body) { throw new Error(error) } else { const Details = LogDetails ? `response:\n${data}` : ''; - const cc = JSON.parse(data) if (data.match(/签到成功/)) { console.log(`\n${title}签到成功(1)${Details}`) - if (data.match(/(\"text\":\"\d+京豆\")/)) { - let beanQuantity = cc.awardList[0].text.match(/\d+/) - merge[key].notify = `${title}: 成功, 明细: ${beanQuantity}京豆 🐶` - merge[key].bean = beanQuantity - merge[key].success = 1 - } else { - merge[key].notify = `${title}: 成功, 明细: 无京豆 🐶` - merge[key].success = 1 + if (data.match(/\"text\":\"\d+京豆\"/)) { + merge[key].bean = data.match(/\"text\":\"(\d+)京豆\"/)[1] } + merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean || '无'}京豆 🐶` + merge[key].success = 1 } else { console.log(`\n${title}签到失败(1)${Details}`) if (data.match(/(已签到|已领取)/)) { merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️` } else if (data.match(/(不存在|已结束|未开始)/)) { merge[key].notify = `${title}: 失败, 原因: 活动已结束 ⚠️` - } else if (cc.code == 3) { + } else if (data.match(/\"code\":\"?3\"?/)) { merge[key].notify = `${title}: 失败, 原因: Cookie失效‼️` } else { merge[key].notify = `${title}: 失败, 原因: 未知 ⚠️` @@ -1006,8 +934,7 @@ async function JDUserSign2(s, key, title, tid) { const JDUrl = { url: 'https://jdjoy.jd.com/api/turncard/channel/sign', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: `turnTableId=${tid}` }; @@ -1017,15 +944,12 @@ async function JDUserSign2(s, key, title, tid) { throw new Error(error) } else { const Details = LogDetails ? `response:\n${data}` : ''; - const cc = JSON.parse(data) - if (cc.success == true) { + if (data.match(/\"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].bean = data.match(/\"jdBeanQuantity\":(\d+)/)[1] } + merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean || '无'}京豆 🐶` merge[key].success = 1 } else { console.log(`\n${title}签到失败(2)${Details}`) @@ -1047,8 +971,8 @@ async function JDUserSign2(s, key, title, tid) { resolve() } }) - }, s) - if (out) setTimeout(resolve, out + s) + }, 200 + s) + if (out) setTimeout(resolve, out + s + 200) }); } @@ -1059,8 +983,7 @@ function JDFlashSale(s) { const JDPETUrl = { url: 'https://api.m.jd.com/client.action?functionId=partitionJdSgin', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: "body=%7B%22version%22%3A%22v2%22%7D&client=apple&clientVersion=9.0.8&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=6768e2cf625427615dd89649dd367d41&st=1597248593305&sv=121" }; @@ -1087,7 +1010,8 @@ function JDFlashSale(s) { } else if (data.match(/(\"code\":\"3\"|\"1003\")/)) { merge.JDFSale.notify = "京东商城-闪购: 失败, 原因: Cookie失效‼️" } else { - merge.JDFSale.notify = "京东商城-闪购: 失败, 原因: 未知 ⚠️" + const msg = data.match(/\"msg\":\"([\u4e00-\u9fa5].+?)\"/) + merge.JDFSale.notify = `京东商城-闪购: 失败, ${msg ? msg[1] : `原因: 未知`} ⚠️` } } } @@ -1108,8 +1032,7 @@ function FlashSaleDivide(s) { const Url = { url: 'https://api.m.jd.com/client.action?functionId=partitionJdShare', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: "body=%7B%22version%22%3A%22v2%22%7D&client=apple&clientVersion=9.0.8&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=49baa3b3899b02bbf06cdf41fe191986&st=1597682588351&sv=111" }; @@ -1135,7 +1058,8 @@ function FlashSaleDivide(s) { } else if (data.match(/\"code\":\"1003\"|未获取/)) { merge.JDFSale.notify = "京东闪购-瓜分: 失败, 原因: Cookie失效‼️" } else { - merge.JDFSale.notify = "京东闪购-瓜分: 失败, 原因: 未知 ⚠️" + const msg = data.match(/\"msg\":\"([\u4e00-\u9fa5].+?)\"/) + merge.JDFSale.notify = `京东闪购-瓜分: 失败, ${msg ? msg[1] : `原因: 未知`} ⚠️` } } } @@ -1157,8 +1081,7 @@ function JingDongCash(s) { const JDCAUrl = { url: 'https://api.m.jd.com/client.action?functionId=ccSignInNew', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: "body=%7B%22pageClickKey%22%3A%22CouponCenter%22%2C%22eid%22%3A%22O5X6JYMZTXIEX4VBCBWEM5PTIZV6HXH7M3AI75EABM5GBZYVQKRGQJ5A2PPO5PSELSRMI72SYF4KTCB4NIU6AZQ3O6C3J7ZVEP3RVDFEBKVN2RER2GTQ%22%2C%22shshshfpb%22%3A%22v1%5C%2FzMYRjEWKgYe%2BUiNwEvaVlrHBQGVwqLx4CsS9PH1s0s0Vs9AWk%2B7vr9KSHh3BQd5NTukznDTZnd75xHzonHnw%3D%3D%22%2C%22childActivityUrl%22%3A%22openapp.jdmobile%253a%252f%252fvirtual%253fparams%253d%257b%255c%2522category%255c%2522%253a%255c%2522jump%255c%2522%252c%255c%2522des%255c%2522%253a%255c%2522couponCenter%255c%2522%257d%22%2C%22monitorSource%22%3A%22cc_sign_ios_index_config%22%7D&client=apple&clientVersion=8.5.0&d_brand=apple&d_model=iPhone8%2C2&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&scope=11&screen=1242%2A2208&sign=1cce8f76d53fc6093b45a466e93044da&st=1581084035269&sv=102" }; @@ -1171,32 +1094,20 @@ function JingDongCash(s) { const cc = JSON.parse(data) if (cc.busiCode == "0") { console.log("\n" + "京东现金-红包签到成功 " + Details) - if (cc.result.signResult.signData.amount) { - merge.JDCash.notify = "京东现金-红包: 成功, 明细: " + cc.result.signResult.signData.amount + "红包 🧧" - merge.JDCash.Cash = cc.result.signResult.signData.amount - merge.JDCash.success = 1 - } else { - merge.JDCash.notify = "京东现金-红包: 成功, 明细: 无红包 🧧" - merge.JDCash.success = 1 - } + merge.JDCash.success = 1 + merge.JDCash.Cash = cc.result.signResult.signData.amount || 0 + merge.JDCash.notify = `京东现金-红包: 成功, 明细: ${merge.JDCash.Cash || `无`}红包 🧧` } else { console.log("\n" + "京东现金-红包签到失败 " + Details) + merge.JDCash.fail = 1 if (data.match(/(\"busiCode\":\"1002\"|完成签到)/)) { merge.JDCash.notify = "京东现金-红包: 失败, 原因: 已签过 ⚠️" - merge.JDCash.fail = 1 + } else if (data.match(/(不存在|已结束)/)) { + merge.JDCash.notify = "京东现金-红包: 失败, 原因: 活动已结束 ⚠️" + } else if (data.match(/(\"busiCode\":\"3\"|未登录)/)) { + merge.JDCash.notify = "京东现金-红包: 失败, 原因: Cookie失效‼️" } else { - if (data.match(/(不存在|已结束)/)) { - merge.JDCash.notify = "京东现金-红包: 失败, 原因: 活动已结束 ⚠️" - merge.JDCash.fail = 1 - } else { - if (data.match(/(\"busiCode\":\"3\"|未登录)/)) { - merge.JDCash.notify = "京东现金-红包: 失败, 原因: Cookie失效‼️" - merge.JDCash.fail = 1 - } else { - merge.JDCash.notify = "京东现金-红包: 失败, 原因: 未知 ⚠️" - merge.JDCash.fail = 1 - } - } + merge.JDCash.notify = "京东现金-红包: 失败, 原因: 未知 ⚠️" } } } @@ -1223,12 +1134,12 @@ function JDMagicCube(s) { $nobyda.get(JDUrl, function(error, response, data) { try { if (error) throw new Error(error) + const Details = LogDetails ? "response:\n" + data : ''; if (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京东魔方-查询活动失败 ") + console.log("\n京东魔方-暂无有效活动 " + Details) } } catch (eor) { $nobyda.AnError("京东魔方-查询", "JDCube", eor) @@ -1260,32 +1171,24 @@ function JDMagicCubeSign(s, id) { const cc = JSON.parse(data) if (data.match(/(\"name\":)/)) { console.log("\n" + "京东商城-魔方签到成功 " + Details) + merge.JDCube.success = 1 if (data.match(/(\"name\":\"京豆\")/)) { - merge.JDCube.notify = "京东商城-魔方: 成功, 明细: " + cc.result.lotteryInfo.quantity + "京豆 🐶" - merge.JDCube.bean = cc.result.lotteryInfo.quantity - merge.JDCube.success = 1 + merge.JDCube.bean = cc.result.lotteryInfo.quantity || 0 + merge.JDCube.notify = `京东商城-魔方: 成功, 明细: ${merge.JDCube.bean || `无`}京豆 🐶` } else { - merge.JDCube.notify = "京东商城-魔方: 成功, 明细: " + cc.result.lotteryInfo.name + " 🎉" - merge.JDCube.success = 1 + merge.JDCube.notify = `京东商城-魔方: 成功, 明细: ${cc.result.lotteryInfo.name || `未知`} 🎉` } } else { console.log("\n" + "京东商城-魔方签到失败 " + Details) + merge.JDCube.fail = 1 if (data.match(/(一闪而过|已签到|已领取)/)) { merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 无机会 ⚠️" - merge.JDCube.fail = 1 + } else if (data.match(/(不存在|已结束)/)) { + merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 活动已结束 ⚠️" + } else if (data.match(/(\"code\":3)/)) { + merge.JDCube.notify = "京东商城-魔方: 失败, 原因: Cookie失效‼️" } else { - if (data.match(/(不存在|已结束)/)) { - merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 活动已结束 ⚠️" - merge.JDCube.fail = 1 - } else { - if (data.match(/(\"code\":3)/)) { - merge.JDCube.notify = "京东商城-魔方: 失败, 原因: Cookie失效‼️" - merge.JDCube.fail = 1 - } else { - merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 未知 ⚠️" - merge.JDCube.fail = 1 - } - } + merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 未知 ⚠️" } } } @@ -1329,12 +1232,11 @@ function JingDongPrize(s) { } } else { console.log("\n" + "京东商城-大奖查询KEY失败 " + Details) + merge.JDPrize.fail = 1 if (data.match(/(未登录|\"101\")/)) { merge.JDPrize.notify = "京东大奖-登录: 失败, 原因: Cookie失效‼️" - merge.JDPrize.fail = 1 } else { merge.JDPrize.notify = "京东大奖-登录: 失败, 原因: 未知 ⚠️" - merge.JDPrize.fail = 1 } } } @@ -1368,24 +1270,20 @@ function JDPrizeCheckin(s) { const c = JSON.parse(data) if (data.match(/\"success\":true/)) { console.log("\n" + "京东商城-大奖签到成功 " + Details) + merge.JDPrize.success = 1 if (data.match(/\"beanNumber\":\d+/)) { merge.JDPrize.notify = "京东商城-大奖: 成功, 明细: " + c.data.beanNumber + "京豆 🐶" - merge.JDPrize.success = 1 merge.JDPrize.bean = c.data.beanNumber } else if (data.match(/\"couponInfoVo\"/)) { if (data.match(/\"limitStr\"/)) { merge.JDPrize.notify = "京东商城-大奖: 获得满" + c.data.couponInfoVo.quota + "减" + c.data.couponInfoVo.discount + "优惠券→ " + c.data.couponInfoVo.limitStr - merge.JDPrize.success = 1 } else { merge.JDPrize.notify = "京东商城-大奖: 成功, 明细: 优惠券" - merge.JDPrize.success = 1 } } else if (data.match(/\"pitType\":0/)) { merge.JDPrize.notify = "京东商城-大奖: 成功, 明细: 未中奖 🐶" - merge.JDPrize.success = 1 } else { merge.JDPrize.notify = "京东商城-大奖: 成功, 明细: 未知 🐶" - merge.JDPrize.success = 1 } } else { console.log("\n" + "京东商城-大奖签到失败 " + Details) @@ -1417,7 +1315,7 @@ function JingDongSpeedUp(s, id) { if (disable("SpeedUp")) return resolve() setTimeout(() => { const GameUrl = { - url: 'https://api.m.jd.com/?appid=memberTaskCenter&functionId=flyTask_' + (id ? 'start&body=%7B%22source%22%3A%22game%22%2C%22source_id%22%3A' + id + '%7D' : 'state&body=%7B%22source%22%3A%22game%22%7D'), + url: `https://api.m.jd.com/?appid=memberTaskCenter&functionId=flyTask_${id?`start&body=%7B%22source%22%3A%22game%22%2C%22source_id%22%3A${id}%7D`:`state&body=%7B%22source%22%3A%22game%22%7D`}`, headers: { Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html', Cookie: KEY @@ -1431,10 +1329,10 @@ function JingDongSpeedUp(s, id) { const Details = LogDetails ? "response:\n" + data : ''; var cc = JSON.parse(data) if (!id) { - var status = merge.SpeedUp.success ? "本次" : "" - console.log("\n" + "天天加速-查询" + status + "任务中 " + Details) + var status = $nobyda.ItemIsUsed ? "再次检查" : merge.SpeedUp.notify ? "查询本次" : "查询上次" + console.log(`\n天天加速-${status}任务 ${Details}`) } else { - console.log("\n" + "天天加速-开始本次任务 " + Details) + console.log(`\n天天加速-开始${$nobyda.ItemIsUsed?`下轮`:`本次`}任务 ${Details}`) } if (cc.message == "not login") { merge.SpeedUp.fail = 1 @@ -1442,24 +1340,35 @@ function JingDongSpeedUp(s, id) { console.log("\n天天加速-Cookie失效") } else if (cc.message == "success") { if (cc.data.task_status == 0 && cc.data.source_id) { - const taskID = cc.data.source_id - await JingDongSpeedUp(s, taskID) - } else if (cc.data.task_status == 1) { - if (!merge.SpeedUp.notify) merge.SpeedUp.fail = 1; - if (!merge.SpeedUp.notify) merge.SpeedUp.notify = "京东天天-加速: 失败, 原因: 加速中 ⚠️"; - const EndTime = cc.data.end_time ? cc.data.end_time : "" - console.log("\n天天加速-目前结束时间: \n" + EndTime) - var step1 = await JDQueryTask(s) - var step2 = await JDReceiveTask(s, step1) - var step3 = await JDQueryTaskID(s, step2) - var step4 = await JDUseProps(s, step3) - } else if (cc.data.task_status == 2) { - if (data.match(/\"beans_num\":\d+/)) { - merge.SpeedUp.notify = "京东天天-加速: 成功, 明细: " + data.match(/\"beans_num\":(\d+)/)[1] + "京豆 🐶" - merge.SpeedUp.bean = data.match(/\"beans_num\":(\d+)/)[1] - } else { - merge.SpeedUp.notify = "京东天天-加速: 成功, 明细: 无京豆 🐶" + if ($nobyda.ItemIsUsed) { //如果使用道具后再次开始任务, 则收到奖励 + console.log("\n天天加速-领取本次奖励成功") + merge.SpeedUp.bean += cc.data.beans_num || 0 + merge.SpeedUp.success = 1 + merge.SpeedUp.notify = `京东天天-加速: 成功, 明细: ${merge.SpeedUp.bean || `无`}京豆 🐶` } + await JingDongSpeedUp(s, cc.data.source_id) + } else if (cc.data.task_status == 1) { + const percent = Math.round((cc.data.done_distance / cc.data.distance) * 100) + console.log(`\n天天加速-目前结束时间: \n${cc.data.end_time} [${percent}%]`) + $nobyda.ItemIsUsed = false + if (!$nobyda.isAllEvents) await JDSpaceEvent(s); //处理太空事件 + if (!$nobyda.isAlltasks) await JDQueryTask(s); //处理太空任务 + var step3 = await JDQueryTaskID(s); //查询道具ID + var step4 = await JDUseProps(s, step3); //使用道具 + if (step4 && $nobyda.ItemIsUsed) { //如果使用了道具, 则再次检查任务 + await JingDongSpeedUp(s) + } else { + $nobyda.isAllEvents = false; //避免多账号问题 + $nobyda.isAlltasks = false; + $nobyda.tryAgain = false; + if (!merge.SpeedUp.notify) { + merge.SpeedUp.fail = 1 + merge.SpeedUp.notify = `京东天天-加速: 失败, 加速中${percent<10?` `:``}[${percent}%] ⚠️` + } + } + } else if (cc.data.task_status == 2) { + merge.SpeedUp.bean = cc.data.beans_num || 0 + merge.SpeedUp.notify = `京东天天-加速: 成功, 明细: ${merge.SpeedUp.bean || `无`}京豆 🐶` merge.SpeedUp.success = 1 console.log("\n天天加速-领取上次奖励成功") await JingDongSpeedUp(s, null) @@ -1469,9 +1378,22 @@ function JingDongSpeedUp(s, id) { console.log("\n" + "天天加速-判断状态码失败") } } else { - merge.SpeedUp.fail = 1 - merge.SpeedUp.notify = "京东天天-加速: 失败, 原因: 未知 ⚠️" - console.log("\n" + "天天加速-判断状态失败") + if (data.match(/领过此任务/)) { //处理任务频繁问题 + if (!$nobyda.tryAgain || $nobyda.tryAgain < 3) { //避免死循环 + $nobyda.tryAgain ? $nobyda.tryAgain += 1 : $nobyda.tryAgain = 1 + console.log(`\n天天加速-延迟一秒查询 (${$nobyda.tryAgain})`); + await JingDongSpeedUp(1000); + } else { + $nobyda.tryAgain = false; + console.log(`\n天天加速-放弃查询任务`); + } + return + } + if (!merge.SpeedUp.notify) { + merge.SpeedUp.fail = 1 + merge.SpeedUp.notify = "京东天天-加速: 失败, 原因: 未知 ⚠️" + } + console.log("\n天天加速-判断状态失败") } } } catch (eor) { @@ -1485,6 +1407,90 @@ function JingDongSpeedUp(s, id) { }); } +function JDSpaceEvent(s) { + return new Promise(resolve => { + var spaceEvents = []; + $nobyda.get({ + url: `https://api.m.jd.com/?appid=memberTaskCenter&functionId=spaceEvent_list&body=%7B%22source%22%3A%22game%22%7D`, + headers: { + Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html', + Cookie: KEY + } + }, (error, response, data) => { + try { + if (error) throw new Error(error) + const cc = JSON.parse(data); + const Details = LogDetails ? "response:\n" + data : ''; + if (cc.message === "success" && cc.data.length > 0) { + for (var item of cc.data) { + if (item.status === 1) { + for (var j of item.options) { + if (j.type === 1) { + spaceEvents.push({ + "id": item.id, + "value": j.value + }) + } + } + } + } + if (spaceEvents && spaceEvents.length > 0) { + console.log(`\n天天加速-查询到${spaceEvents.length}个有效事件 ${Details}`) + } else { + console.log(`\n天天加速-暂无太空事件 ${Details}`) + } + } else { + console.log(`\n天天加速-太空事件为空 ${Details}`) + } + } catch (eor) { + $nobyda.AnError("太空事件-查询", "SpeedUp", eor) + } finally { + resolve(spaceEvents) + } + }) + if (out) setTimeout(resolve, out + s) + }).then(async (list) => { + await new Promise(resolve => { + if (list && list.length > 0) { + var spaceEventCount = 0; + var spaceNumTask = 0; + for (var item of list) { + $nobyda.get({ + url: `https://api.m.jd.com/?appid=memberTaskCenter&functionId=spaceEvent_handleEvent&body=%7B%22source%22%3A%22game%22%2C%22eventId%22%3A${item.id}%2C%22option%22%3A%22${item.value}%22%7D`, + headers: { + Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html', + Cookie: KEY + } + }, (error, response, data) => { + try { + spaceEventCount++ + if (error) throw new Error(error) + const cc = JSON.parse(data); + const Details = LogDetails ? "response:\n" + data : ''; + console.log(`\n天天加速-尝试领取第${spaceEventCount}个事件 ${Details}`) + if (cc.message == "success" && cc.success) { + spaceNumTask += 1; + } + } catch (eor) { + $nobyda.AnError("太空事件-领取", "SpeedUp", eor) + } finally { + if (list.length == spaceEventCount) { + if (list.length == spaceNumTask) $nobyda.isAllEvents = true; //避免重复查询 + console.log(`\n天天加速-已成功领取${spaceNumTask}个事件`) + resolve() + } + } + }) + } + if (out) setTimeout(resolve, out + s) + } else { + $nobyda.isAllEvents = true; //避免重复查询 + resolve() + } + }) + }) +} + function JDQueryTask(s) { return new Promise(resolve => { setTimeout(() => { @@ -1511,12 +1517,12 @@ function JDQueryTask(s) { } if (TaskID.length > 0) { TaskID = TaskID.substr(0, TaskID.length - 1).split(",") - console.log("\n天天加速-查询到" + TaskID.length + "个有效道具" + Details) + console.log("\n天天加速-查询到" + TaskID.length + "个有效道具 " + Details) } else { - console.log("\n天天加速-暂无有效道具" + Details) + console.log("\n天天加速-暂无有效道具 " + Details) } } else { - console.log("\n天天加速-查询无道具" + Details) + console.log("\n天天加速-查询无道具 " + Details) } } } catch (eor) { @@ -1527,14 +1533,10 @@ function JDQueryTask(s) { }) }, s) if (out) setTimeout(resolve, out + s) - }); -} - -function JDReceiveTask(s, CID) { - return new Promise(resolve => { - var NumTask = 0 - if (CID) { - setTimeout(() => { + }).then(async (CID) => { + await new Promise(resolve => { + var NumTask = 0 + if (CID) { var count = 0 for (var i = 0; i < CID.length; i++) { const TUrl = { @@ -1552,76 +1554,73 @@ function JDReceiveTask(s, CID) { } else { const cc = JSON.parse(data) const Details = LogDetails ? "response:\n" + data : ''; - console.log("\n天天加速-尝试领取第" + count + "个道具" + Details) + console.log("\n天天加速-尝试领取第" + count + "个道具 " + Details) if (cc.message == 'success') { NumTask += 1 } } - } catch (eor) { $nobyda.AnError("领取道具-加速", "SpeedUp", eor) } finally { if (CID.length == count) { + if (CID.length == NumTask) $nobyda.isAlltasks = true; //避免重复查询 console.log("\n天天加速-已成功领取" + NumTask + "个道具") resolve(NumTask) } } }) } - }, s) - if (out) setTimeout(resolve, out + s) - } else { - resolve(NumTask) - } - }); + if (out) setTimeout(resolve, out + s) + } else { + $nobyda.isAlltasks = true; //避免重复查询 + resolve(NumTask) + } + }) + }) } -function JDQueryTaskID(s, EID) { +function JDQueryTaskID(s) { return new Promise(resolve => { var TaskCID = "" - if (EID) { - setTimeout(() => { - const EUrl = { - url: 'https://api.m.jd.com/?appid=memberTaskCenter&functionId=energyProp_usalbeList&body=%7B%22source%22%3A%22game%22%7D', - headers: { - Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html', - Cookie: KEY - } - }; - $nobyda.get(EUrl, function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const cc = JSON.parse(data) - const Details = LogDetails ? "response:\n" + data : ''; - if (cc.data.length > 0) { - for (var i = 0; i < cc.data.length; i++) { - if (cc.data[i].id) { - TaskCID += cc.data[i].id + ","; - } + setTimeout(() => { + const EUrl = { + url: 'https://api.m.jd.com/?appid=memberTaskCenter&functionId=energyProp_usalbeList&body=%7B%22source%22%3A%22game%22%7D', + headers: { + Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html', + Cookie: KEY + } + }; + $nobyda.get(EUrl, function(error, response, data) { + try { + if (error) { + throw new Error(error) + } else { + const cc = JSON.parse(data) + const Details = LogDetails ? "response:\n" + data : ''; + if (cc.data.length > 0) { + for (var i = 0; i < cc.data.length; i++) { + if (cc.data[i].id) { + TaskCID += cc.data[i].id + ","; } - if (TaskCID.length > 0) { - TaskCID = TaskCID.substr(0, TaskCID.length - 1).split(",") - console.log("\n天天加速-查询成功" + TaskCID.length + "个道具ID" + Details) - } else { - console.log("\n天天加速-暂无有效道具ID" + Details) - } - } else { - console.log("\n天天加速-查询无道具ID" + Details) } + if (TaskCID.length > 0) { + TaskCID = TaskCID.substr(0, TaskCID.length - 1).split(",") + console.log(`\n天天加速-查询成功${TaskCID.length}个道具ID ${Details}`) + } else { + console.log(`\n天天加速-暂无有效道具ID ${Details}`) + } + } else { + console.log(`\n天天加速-查询无道具ID ${Details}`) } - } catch (eor) { - $nobyda.AnError("查询号码-加速", "SpeedUp", eor) - } finally { - resolve(TaskCID) } - }) - }, s + 200) - if (out) setTimeout(resolve, out + s) - } else { - resolve(TaskCID) - } + } catch (eor) { + $nobyda.AnError("查询号码-加速", "SpeedUp", eor) + } finally { + resolve(TaskCID) + } + }) + }, s + 200) + if (out) setTimeout(resolve, out + s) }); } @@ -1647,18 +1646,18 @@ function JDUseProps(s, PropID) { } else { const cc = JSON.parse(data) const Details = LogDetails ? "response:\n" + data : ''; - console.log("\n天天加速-尝试使用第" + PropCount + "个道具" + Details) + console.log("\n天天加速-尝试使用第" + PropCount + "个道具 " + Details) if (cc.message == 'success' && cc.success == true) { PropNumTask += 1 } } - } catch (eor) { $nobyda.AnError("使用道具-加速", "SpeedUp", eor) } finally { if (PropID.length == PropCount) { console.log("\n天天加速-已成功使用" + PropNumTask + "个道具") - resolve() + if (PropNumTask) $nobyda.ItemIsUsed = true; + resolve(PropNumTask) } } }) @@ -1727,7 +1726,6 @@ function JingRongDoll(s, type, num) { const DollUrl = { url: "https://nu.jr.jd.com/gw/generic/jrm/h5/m/process", headers: { - "Content-Type": "application/x-www-form-urlencoded", Cookie: KEY }, body: "reqData=%7B%22actCode%22%3A%22890418F764%22%2C%22type%22%3A" + (type ? type : "3") + "%7D" @@ -1793,8 +1791,7 @@ function JDOverseas(s) { const OverseasUrl = { url: 'https://api.m.jd.com/client.action?functionId=checkin', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: "body=%7B%7D&build=167237&client=apple&clientVersion=9.0.0&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&partner=apple&scope=11&sign=e27f8b904040a0e3c99b87fc27e09c87&st=1591730990449&sv=101" }; @@ -1885,6 +1882,119 @@ function JingDongGetCash(s) { }); } +function JingDongWebcasts(s) { + return new Promise(resolve => { + if (disable("JDWebcasts")) return resolve() + setTimeout(() => { + $nobyda.get({ + url: `https://api.m.jd.com/api?functionId=getChannelTaskRewardToM&appid=h5-live&body=%7B%22type%22%3A%22signTask%22%2C%22itemId%22%3A%221%22%7D`, + headers: { + Cookie: KEY, + Origin: `https://h.m.jd.com` + } + }, (error, response, data) => { + try { + if (error) throw new Error(error) + const cc = JSON.parse(data); + const Details = LogDetails ? "response:\n" + data : ''; + if (cc.code == 0 && cc.subCode == 0) { + console.log(`\n京东商城-直播签到成功 ${Details}`) + merge.JDWebcasts.bean = cc.sum || 0 + merge.JDWebcasts.success = 1 + merge.JDWebcasts.notify = `京东商城-直播: 成功, 明细: ${merge.JDWebcasts.bean||`无`}京豆 🐶` + } else { + console.log(`\n京东商城-直播签到失败 ${Details}`) + const tp = data.match(/擦肩而过/) ? `无机会` : cc.code == 3 ? `Cookie失效` : `${cc.msg||`未知`}` + merge.JDWebcasts.notify = `京东商城-直播: 失败, 原因: ${tp}${cc.code==3?`‼️`:` ⚠️`}` + merge.JDWebcasts.fail = 1 + } + } catch (eor) { + $nobyda.AnError("京东商城-直播", "JDWebcasts", eor) + } finally { + resolve() + } + }) + }, s) + if (out) setTimeout(resolve, out + s) + }); +} + +function JDTakeaLook(s) { + return new Promise(resolve => { + if (disable("TakeaLook")) return resolve() + setTimeout(() => { + $nobyda.get({ + url: 'https://api.m.jd.com/client.action?functionId=discTaskList&body=%7B%22bizType%22%3A1%2C%22referPageId%22%3A%22discRecommend%22%7D&client=apple&clientVersion=9.1.6&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=17061147fe8e0eb10edfe8d9968b6d66&st=1601138337675&sv=102', + headers: { + Cookie: KEY + } + }, (error, response, data) => { + try { + if (error) throw new Error(error); + const cc = JSON.parse(data); + const Details = LogDetails ? "response:\n" + data : ''; + const tm = new Date(new Date().setHours(0, 0, 0, 0)).getTime() + if (data.match(/签到成功/) && !data.match(tm)) { + console.log(`\n京东发现-看看签到成功 ${Details}`) + const aw = data.match(/\"签到成功,获得(\d+)京豆\"/) + merge.TakeaLook.success = 1 + merge.TakeaLook.bean = aw ? aw[1] : 0 + merge.TakeaLook.notify = `京东发现-看看: 成功, 明细: ${merge.TakeaLook.bean||`无`}京豆 🐶` + } else { + console.log(`\n京东发现-看看签到失败 ${Details}`) + const tp = data.match(tm) ? `已签过` : cc.busiCode == 2001 ? `Cookie失效` : `${cc.message||`未知`}` + merge.TakeaLook.notify = `京东发现-看看: 失败, 原因: ${tp}${cc.busiCode==2001?`‼️`:` ⚠️`}` + merge.TakeaLook.fail = 1 + } + } catch (eor) { + $nobyda.AnError("京东发现-看看", "TakeaLook", eor) + } finally { + resolve() + } + }) + }, s) + if (out) setTimeout(resolve, out) + }); +} + +function JingDongStore(s) { + return new Promise(resolve => { + if (disable("JDGStore")) return resolve() + setTimeout(() => { + $nobyda.get({ + url: 'https://api.m.jd.com/api?appid=jdsupermarket&functionId=smtg_sign&clientVersion=8.0.0&client=m&body=%7B%7D', + headers: { + Cookie: KEY, + Origin: `https://jdsupermarket.jd.com` + } + }, (error, response, data) => { + try { + if (error) throw new Error(error); + const cc = JSON.parse(data); + const Details = LogDetails ? "response:\n" + data : ''; + if (cc.data && cc.data.success === true && cc.data.bizCode === 0) { + console.log(`\n京东商城-超市签到成功 ${Details}`) + merge.JDGStore.success = 1 + merge.JDGStore.bean = cc.data.result.jdBeanCount || 0 + merge.JDGStore.notify = `京东商城-超市: 成功, 明细: ${merge.JDGStore.bean||`无`}京豆 🐶` + } else { + if (!cc.data) cc.data = {} + console.log(`\n京东商城-超市签到失败 ${Details}`) + const tp = cc.data.bizCode == 811 ? `已签过` : cc.data.bizCode == 300 ? `Cookie失效` : `${cc.data.bizMsg||`未知`}` + merge.JDGStore.notify = `京东商城-超市: 失败, 原因: ${tp}${cc.data.bizCode==300?`‼️`:` ⚠️`}` + merge.JDGStore.fail = 1 + } + } catch (eor) { + $nobyda.AnError("京东商城-超市", "JDGStore", eor) + } finally { + resolve() + } + }) + }, s) + if (out) setTimeout(resolve, out) + }); +} + function TotalSteel() { return new Promise(resolve => { if (disable("TSteel")) return resolve() @@ -1965,8 +2075,7 @@ function TotalCash() { const CashUrl = { url: 'https://api.m.jd.com/client.action?functionId=myhongbao_balance', headers: { - "Content-Type": "application/x-www-form-urlencoded", - Cookie: KEY, + Cookie: KEY }, body: "body=%7B%22fp%22%3A%22-1%22%2C%22appToken%22%3A%22apphongbao_token%22%2C%22childActivityUrl%22%3A%22-1%22%2C%22country%22%3A%22cn%22%2C%22openId%22%3A%22-1%22%2C%22childActivityId%22%3A%22-1%22%2C%22applicantErp%22%3A%22-1%22%2C%22platformId%22%3A%22appHongBao%22%2C%22isRvc%22%3A%22-1%22%2C%22orgType%22%3A%222%22%2C%22activityType%22%3A%221%22%2C%22shshshfpb%22%3A%22-1%22%2C%22platformToken%22%3A%22apphongbao_token%22%2C%22organization%22%3A%22JD%22%2C%22pageClickKey%22%3A%22-1%22%2C%22platform%22%3A%221%22%2C%22eid%22%3A%22-1%22%2C%22appId%22%3A%22appHongBao%22%2C%22childActiveName%22%3A%22-1%22%2C%22shshshfp%22%3A%22-1%22%2C%22jda%22%3A%22-1%22%2C%22extend%22%3A%22-1%22%2C%22shshshfpa%22%3A%22-1%22%2C%22activityArea%22%3A%22-1%22%2C%22childActivityTime%22%3A%22-1%22%7D&client=apple&clientVersion=8.5.0&d_brand=apple&networklibtype=JDNetworkBaseAF&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=fdc04c3ab0ee9148f947d24fb087b55d&st=1581245397648&sv=120" }; @@ -2030,8 +2139,16 @@ function disable(Val, name, way) { function initial() { acData = { - // 京东商城-夺宝 - JDTreasure: '29xMZdGiiGYmMZ5CQcGmb7iPhN7n', + // 京东商城-校园 + JDSchool: '4812pn2PAcUyfNdWr7Cvpww5MCyW', + // 京东商城-鞋靴 + JDShoes: '4RXyb1W4Y986LJW8ToqMK14BdTD', + // 京东商城-电竞 + JDEsports: 'CHdHQhA5AYDXXQN9FLt3QUAPRsB', + // 京东商城-日历 + JDCalendar: '36V2Qw59VPNsuLxY84vCFtxFzrFs', + // 京东商城-童装 + JDChild: '3Af6mZNcf5m795T8dtDVfDwWVNhJ', // 京东商城-母婴 JDBaby: '3BbAVGQPDd6vTyHYjmAutXrKAos6', // 京东商城-数码 @@ -2042,8 +2159,6 @@ function initial() { JDClocks: '2BcJPCVVzMEtMUynXkPscCSsx68W', // 京东商城-医药 JDDrug: '3tqTG5sF1xCUyC6vgEF5CLCxGn7w', - // 京东商城-超市 - JDGStore: 'aNCM6yrzD6qp1Vvh5YTzeJtk7cM', // 京东商城-宠物 JDPet: '37ta5sh5ocrMZF3Fz5UMJbTsL42', // 京东商城-图书 @@ -2072,11 +2187,16 @@ function initial() { JDTurn: {}, JRDoll: {}, JRDSign: {}, + TakeaLook: {}, Overseas: {}, JDFSale: {}, JDPet: {}, + JDEsports: {}, + JDSchool: {}, + JDCalendar: {}, + JDShoes: {}, JD3C: {}, - JDTreasure: {}, + JDChild: {}, JDBaby: {}, JDSubsidy: {}, JDDrug: {}, @@ -2091,6 +2211,7 @@ function initial() { JDClean: {}, JDVege: {}, JDJewels: {}, + JDWebcasts: {}, JDCube: {}, JDPrize: {}, JRSteel: {}, @@ -2183,11 +2304,14 @@ function nobyda() { const isLoon = typeof $loon != "undefined" const isJSBox = typeof $app != "undefined" && typeof $http != "undefined" const isNode = typeof require == "function" && !isJSBox; + const NodeSet = 'CookieSet.json' const node = (() => { if (isNode) { const request = require('request'); + const fs = require("fs"); return ({ - request + request, + fs }) } else { return (null) @@ -2196,7 +2320,7 @@ function nobyda() { const notify = (title, subtitle, message) => { if (isQuanX) $notify(title, subtitle, message) if (isSurge) $notification.post(title, subtitle, message) - if (isNode) log(title + subtitle + message) + if (isNode) console.log(`${title}\n${subtitle}\n${message}`) if (isJSBox) $push.schedule({ title: title, body: subtitle ? subtitle + "\n" + message : message @@ -2205,10 +2329,43 @@ function nobyda() { const write = (value, key) => { if (isQuanX) return $prefs.setValueForKey(value, key) if (isSurge) return $persistentStore.write(value, key) + if (isNode) { + try { + if (!node.fs.existsSync(NodeSet)) node.fs.writeFileSync(NodeSet, JSON.stringify({})); + const dataValue = JSON.parse(node.fs.readFileSync(NodeSet)); + if (value) dataValue[key] = value; + if (!value) delete dataValue[key]; + return node.fs.writeFileSync(NodeSet, JSON.stringify(dataValue)); + } catch (er) { + return AnError('Node.js持久化写入', null, er); + } + } + if (isJSBox) { + if (!value) return $file.delete(`shared://${key}.txt`); + return $file.write({ + data: $data({ + string: value + }), + path: `shared://${key}.txt` + }) + } } const read = (key) => { if (isQuanX) return $prefs.valueForKey(key) if (isSurge) return $persistentStore.read(key) + if (isNode) { + try { + if (!node.fs.existsSync(NodeSet)) return null; + const dataValue = JSON.parse(node.fs.readFileSync(NodeSet)) + return dataValue[key] + } catch (er) { + return AnError('Node.js持久化读取', null, er) + } + } + if (isJSBox) { + if (!$file.exists(`shared://${key}.txt`)) return null; + return $file.read(`shared://${key}.txt`).string + } } const adapterStatus = (response) => { if (response) { @@ -2227,9 +2384,9 @@ function nobyda() { url: options } options["method"] = "GET" - options["opts"] = { - "hints": false - } + //options["opts"] = { + // "hints": false + //} $task.fetch(options).then(response => { callback(null, adapterStatus(response), response.body) }, reason => callback(reason.error, null, null)) @@ -2262,14 +2419,15 @@ function nobyda() { } const post = (options, callback) => { options.headers['User-Agent'] = 'JD4iPhone/167169 (iPhone; iOS 13.4.1; Scale/3.00)' + if (options.body) options.headers['Content-Type'] = 'application/x-www-form-urlencoded' if (isQuanX) { if (typeof options == "string") options = { url: options } options["method"] = "POST" - options["opts"] = { - "hints": false - } + //options["opts"] = { + // "hints": false + //} $task.fetch(options).then(response => { callback(null, adapterStatus(response), response.body) }, reason => callback(reason.error, null, null)) @@ -2300,14 +2458,15 @@ function nobyda() { $http.post(options); } } - const log = (message) => console.log(message) - const AnError = (name, key, er) => { - if (!merge[key].notify) { - merge[key].notify = `${name}: 异常, 已输出日志 ‼️` - } else { - merge[key].notify += `\n${name}: 异常, 已输出日志 ‼️ (2)` + const AnError = (name, keyname, er) => { + if (typeof(merge) != "undefined" && keyname) { + if (!merge[keyname].notify) { + merge[keyname].notify = `${name}: 异常, 已输出日志 ‼️` + } else { + merge[keyname].notify += `\n${name}: 异常, 已输出日志 ‼️ (2)` + } + merge[keyname].error = 1 } - merge[key].error = 1 return console.log(`\n‼️${name}发生错误\n‼️名称: ${er.name}\n‼️描述: ${er.message}${JSON.stringify(er).match(/\"line\"/) ? `\n‼️行列: ${JSON.stringify(er)}` : ``}`) } const time = () => { @@ -2331,9 +2490,8 @@ function nobyda() { read, get, post, - log, time, done } }; -ReadCookie(); \ No newline at end of file +ReadCookie(); diff --git a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh index 0b14e2bc27..58cf990039 100755 --- a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh +++ b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh @@ -96,16 +96,21 @@ add_cron() { serverchan() { sckey=$(uci_get_by_type global serverchan) failed=$(uci_get_by_type global failed) - desc=$(cat /www/JD_DailyBonus.htm | sed 's/$/&\n/g' | sed -e '/左滑/d') + desc=$(cat /www/JD_DailyBonus.htm | grep -E '签到号|签到概览|签到总计|账号总计|其他总计' | sed 's/$/&\n/g') + serverurlflag=$(uci_get_by_type global serverurl) + serverurl=https://sc.ftqq.com/ + if [ "$serverurlflag" = "sct" ]; then + serverurl=https://sctapi.ftqq.com/ + fi if [ $failed -eq 1 ]; then grep "Cookie失效" /www/JD_DailyBonus.htm > /dev/null if [ $? -eq 0 ]; then title="$(date '+%Y年%m月%d日') 京东签到 Cookie 失效" - wget-ssl -q --output-document=/dev/null --post-data="text=$title~&desp=$desc" https://sc.ftqq.com/$sckey.send + wget-ssl -q --output-document=/dev/null --post-data="text=$title~&desp=$desc" $serverurl$sckey.send fi else title="$(date '+%Y年%m月%d日') 京东签到" - wget-ssl -q --output-document=/dev/null --post-data="text=$title~&desp=$desc" https://sc.ftqq.com/$sckey.send + wget-ssl -q --output-document=/dev/null --post-data="text=$title~&desp=$desc" $serverurl$sckey.send fi } @@ -155,12 +160,16 @@ update() { fi } -while getopts ":anruswh" arg; do +while getopts ":alnruswh" arg; do case "$arg" in a) add_cron exit 0 ;; + l) + serverchan + exit 0 + ;; n) check_ver exit 0