This commit is contained in:
Faker 2023-05-24 17:47:31 +08:00
parent a0ec0f5b24
commit eb096222b0

View File

@ -32,13 +32,14 @@ if ($.isNode()) {
console.log("优惠劵失败...")
return;
}
if (codeList.length === 0) {
$.randomCode = random(10, 13);
// console.log($.randomCode)
// console.log(codeList.length)
if (codeList.length <= 1) {
console.log("暂无优惠劵...")
return;
}
// console.log(codeList)
if ($.randomCode === 10){
console.log("优惠券地址: https://u.jd.com/"+codeList[0])
$.jfurl = "https://u.jd.com/"+codeList[0]
@ -51,12 +52,11 @@ if ($.isNode()) {
await getShorttoLong()
console.log("\n---- 执行 ----")
// cookiesArr = cookiesArr.sort(function() {
// return .5 - Math.random();
// });
let ckNum = cookiesArr.length > 5 ? 5 : cookiesArr.length;
// console.log(ckNum)
for (let i = 0; i < ckNum; i++) {
cookiesArr = cookiesArr.sort(function() {
return .5 - Math.random();
});
// let ckNum = cookiesArr.length > 1 ? 1 : cookiesArr.length;
for (let i = 0; i < 1; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
@ -82,7 +82,7 @@ if ($.isNode()) {
await $.wait(4000);
}
}
}
})().catch((e) => { $.log('', `${$.name}, 失败! 原因: ${e}!`, '') }).finally(() => { $.done(); })