This commit is contained in:
cdle 2021-08-19 08:20:06 +08:00
parent f74da6ebf6
commit b0c73741f9

View File

@ -24,9 +24,9 @@ if (process.env.tytpacketId) {
}
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
})
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
cookiesArr.push(jdCookieNode[item])
})
// if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
} else {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
}
@ -39,7 +39,7 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action';
});
return;
}
console.log("推一推开始")
for (let i = cookiesArr.length - 1; i > 0; i--) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
@ -49,7 +49,7 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action';
$.nickName = '';
message = '';
await TotalBean();
console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
// console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
@ -67,6 +67,7 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action';
await $.wait(10000)
}
}
console.log("推一推结束")
})()
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
@ -93,19 +94,17 @@ function tythelp() {
$.post(options, async(err, resp, data) => {
try {
data = JSON.parse(data);
console.log(data.msg)
if (data.code == 0) {
console.log("帮砍:" + data.data.amount)
} else
if (data.msg.indexOf("完成") != -1) {
} else if (data.msg.indexOf("完成") != -1) {
console.log("砍价成功")
status = 1
} else {
console.log(data.msg)
}
console.log(data.msg)
} catch (e) {
$.logErr(e, resp);
} finally {
@ -159,8 +158,8 @@ async function TotalBean() {
$.post(options, (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
// console.log(`${JSON.stringify(err)}`)
// console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (data) {
data = JSON.parse(data);
@ -174,7 +173,7 @@ async function TotalBean() {
$.nickName = $.UserName;
}
} else {
console.log(`京东服务器返回空数据`)
// console.log(`京东服务器返回空数据`)
}
}
} catch (e) {
@ -191,8 +190,8 @@ async function safeGet(data) {
return true;
}
} catch (e) {
console.log(e);
console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
// console.log(e);
// console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
return false;
}
}
@ -202,7 +201,7 @@ function jsonParse(str) {
try {
return JSON.parse(str);
} catch (e) {
console.log(e);
// console.log(e);
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
return [];
}
@ -530,12 +529,12 @@ function Env(t, e) {
}
};
if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) {
let t = ["", "==============📣系统通知📣=============="];
t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t)
// let t = ["", "==============📣系统通知📣=============="];
// t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t)
}
}
log(...t) {
t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator))
// t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator))
}
logErr(t, e) {
const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();