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