Skip to content

Commit

Permalink
修复每次运行都会给好友喂食一次的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lxk0301 committed Jan 22, 2021
1 parent be5587f commit 777e6b6
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 31 deletions.
17 changes: 8 additions & 9 deletions JD_extra_cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,23 @@ Github: https://github.com/dompling
使用方式:在代理软件配置好下方配置后,复制 https://home.m.jd.com/myJd/newhome.action 到浏览器打开 ,在个人中心自动获取 cookie,
若弹出成功则正常使用。否则继续再此页面继续刷新一下试试
===================
new Env('获取多账号京东Cookie');//此处忽略即可,为自动生成iOS端软件配置文件所需
===================
[MITM]
hostname = wq.jd.com
===================Surge===================
[Script]
获取京东Cookie = type=http-request,pattern=^https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion,requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js,script-update-interval=0
===================Loon===================
[Script]
http-request https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion tag=获取京东Cookie, script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js
===================Quantumult X=====================
[rewrite_local]
# 获取多账号京东Cookie
https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion url script-request-header https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js
===================Loon===================
[Script]
http-request https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js, tag=获取多账号京东Cookie
===================Surge===================
[Script]
获取多账号京东Cookie = type=http-request,pattern=^https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion,requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js,script-update-interval=0
*/

const APIKey = "CookiesJD";
Expand Down
1 change: 1 addition & 0 deletions jd_joy_help.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions jd_joy_steal.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ if ($.isNode() && process.env.jdJoyStealCoin) {
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
$.HelpFeed = ctrTemp;
if (!ctrTemp) $.HelpFeed = true
$.HelpFeedFlag = ctrTemp;
if (!ctrTemp) $.HelpFeedFlag = true
await TotalBean();
console.log(`\n开始【京东账号${$.index}${$.nickName || $.UserName}\n`);
if (!$.isLogin) {
Expand Down Expand Up @@ -163,7 +163,8 @@ async function jdJoySteal() {
console.log('帮好友喂食失败,狗粮不足10g 跳出\n');
break
}
if (!$.HelpFeed) {
if ($.help_feed >= 10) $.HelpFeedFlag = false;//修复每次运行都会给好友喂食一次的bug
if (!$.HelpFeedFlag) {
console.log('您已设置不为好友喂食,现在跳过喂食,如需为好友喂食请在BoxJs打开喂食开关或者更改脚本 jdJoyHelpFeed 处');
break
}
Expand Down Expand Up @@ -232,7 +233,7 @@ async function stealFriendCoinFun() {
//给好友喂食
async function helpFriendsFeed() {
if ($.help_feed !== 200) {
if ($.HelpFeed) {
if ($.HelpFeedFlag) {
console.log(`\n开始给好友喂食`);
for (let friends of $.allFriends) {
const { friendPin, status, stealStatus } = friends;
Expand All @@ -245,7 +246,7 @@ async function helpFriendsFeed() {
console.log(`帮好友[${friendPin}]喂食10g狗粮成功,你获得10积分\n`);
if (!ctrTemp) {
$.log('为完成为好友单独喂食一次的任务,故此处进行喂食一次')
$.HelpFeed = false;
$.HelpFeedFlag = false;
break
}
$.helpFood += 10;
Expand Down
41 changes: 24 additions & 17 deletions jd_petTreasureBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
1、进入聚宝盆,显示本轮狗粮池投入总数,方便估算
2、可能有两位数误差,影响不大
3、聚宝盆最下方显示上轮前六名的投入狗粮,收入积分,以及纯收益(即:收入积分 - 投入狗粮)
new Env('聚宝盆投狗粮辅助');//此处忽略即可,为自动生成iOS端软件配置文件所需
[MITM]
hostname = jdjoy.jd.com,draw.jdfcloud.com
Expand All @@ -21,22 +22,23 @@ hostname = jdjoy.jd.com,draw.jdfcloud.com
http-response ^https:\/\/jdjoy\.jd\.com\/pet\/getPetTreasureBox|^https:\/\/draw\.jdfcloud\.com\/\/pet\/getPetTreasureBox script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_petTreasureBox.js, requires-body=true, timeout=3600, tag=聚宝盆投狗粮辅助
*/
let body = $response.body
body = JSON.parse(body)
food = body['data']['food']
function f(v) {
let body = $response.body;
try {
body = JSON.parse(body)
food = body['data']['food']
function f(v) {
return (v < 0) ? v : `+${v}`;
}
var sum = 0
lastHourWinInfos = body["data"]["lastHourWinInfos"]
for (var i in lastHourWinInfos) {
}
var sum = 0
lastHourWinInfos = body["data"]["lastHourWinInfos"]
for (var i in lastHourWinInfos) {
sum += lastHourWinInfos[i]["petCoin"]
}
for (var i in lastHourWinInfos) {
}
for (var i in lastHourWinInfos) {
body["data"]["lastHourWinInfos"][i]["petCoin"] = `{${lastHourWinInfos[i]["food"]}} [${lastHourWinInfos[i]["petCoin"]}] (${f(lastHourWinInfos[i]["petCoin"] - lastHourWinInfos[i]["food"])}) `
}
}

body["data"]["lastHourWinInfos"].unshift({
body["data"]["lastHourWinInfos"].unshift({
'pin': "",
'nickName': '',
'investHour': lastHourWinInfos[0]['investHour'],
Expand All @@ -47,8 +49,13 @@ body["data"]["lastHourWinInfos"].unshift({
'petCoin': '{投} [收入] (纯收入)',
'userTag': "",
'win': true
})
lastTurnFood = parseInt(sum / 0.09 * 0.91)
body['data']['food'] = `${food} (+${food - lastTurnFood})`
body = JSON.stringify(body)
$done({ body })
})
lastTurnFood = parseInt(sum / 0.09 * 0.91)
body['data']['food'] = `${food} (+${food - lastTurnFood})`
body = JSON.stringify(body)
} catch (e) {
console.log(e)
} finally {
$done({ body })
}

0 comments on commit 777e6b6

Please sign in to comment.