更新J抽奖

This commit is contained in:
youfak 2024-11-06 09:48:27 +08:00
parent 922c7b6aba
commit 2bf6d0c812

51
bear.js
View File

@ -3217,14 +3217,40 @@ class IlIIlIli {
this.shopName = l1illi1l;
this.rule = lIIiI1lI;
this.buyerSign = lIlll('#buyerSign')?.val() || '';
IlIIlIli.activity.actType = actType
if (this.activityUrl.includes("loadBlindBox")) {
IlIIlIli.activity.prizeList = JSON.parse(lIlll('#jdEquityList').attr("value"));
} else {
IlIIlIli.activity.prizeList = JSON.parse(lIlll('#awards', 'body').text());
if (this.activityUrl.includes("loadBlindBox")) {
IlIIlIli.activity.prizeList = JSON.parse(lIlll('#jdEquityList').attr("value"));
} else {
IlIIlIli.activity.prizeList = JSON.parse(lIlll('#awards', 'body').text());
}
}
if (this.activityUrl.includes("showSign")) {
let description = this.rule.replace(/;/g, '\n');
let dailySignIn = [];
let continuousSignIn = [];
for (const item of description.split("\n")) {
let dailySignInMatch = item.match(/每日签到赠送(\d+)([\u4e00-\u9fa5]{2})/);
if (dailySignInMatch) {
dailySignIn.push({
type: "每日签到",
quantity: parseInt(dailySignInMatch[1]),
unit: (dailySignInMatch[2])
});
}
let continuousSignInMatch = item.match(/连续签到(\d+)天,赠送(\d+)([\u4e00-\u9fa5]{2})/);
if (continuousSignInMatch) {
continuousSignIn.push({
type: "连续签到",
dayNum: parseInt(continuousSignInMatch[1]),
quantity: parseInt(continuousSignInMatch[2]),
unit: continuousSignInMatch[3]
});
}
}
IlIIlIli.activity.prizeList = [...dailySignIn, ...continuousSignIn];
}
const IllIll11 = lIlll("title").text();
return IlIIlIli.activity.shopName = this.shopName, IlIIlIli.activity.shopId = this.shopId, IlIIlIli.activity.venderId = this.venderId, await this.getRuleSETime(lIIiI1lI), IllIll11?.["includes"]("已结束") && (this.putMsg("活动已结束"), await this.writeLongCacheByStop(), this.stop()), lIlll;
return IlIIlIli.activity.shopName = this.shopName, IlIIlIli.activity.shopId = this.shopId, IlIIlIli.activity.venderId = this.venderId, IlIIlIli.activity.actType = actType, await this.getRuleSETime(lIIiI1lI), IllIll11?.["includes"]("已结束") && (this.putMsg("活动已结束"), await this.writeLongCacheByStop(), this.stop()), lIlll;
}
return undefined;
}
@ -3830,6 +3856,7 @@ class Iii1iI1i {
}
if ((Array.isArray(body.prizeList) && body.prizeList.length > 0)) {
let msg = ["空气", "谢谢参与", "谢谢参与!", "再来一次"];
for (let i = 0; i < body.prizeList.length; i++) {
let list = body.prizeList[i];
if (IlIIlIli.activity.daysign && i < IlIIlIli.activity.daysign.length) { // 确保索引在范围内
@ -3855,7 +3882,7 @@ class Iii1iI1i {
break;
case "Draw":
case "TaskDraw":
if (lIliI1Ii.includes(list.equityName)) continue;
if (msg.includes(list.equityName)) continue;
if (list.equityName == "京豆") list.equityName = list.denomination + "京豆"
if (list.equityName == "京东") list.equityName = list.denomination + "京豆"
if (list.equityName == "积分") list.equityName = list.denomination + "积分"
@ -3863,7 +3890,11 @@ class Iii1iI1i {
lIliI1Ii += " " + list.equityName + " 共" + list.availableQuantity + "/" + list.freezeQuantity + "份\n";
break;
case "SignAct":
lIliI1Ii += " " + list.replace("签到赠送", " ").replace("连续签到", "").replace(",赠送", " ") + "\n";
if (list.dayNum) {
lIliI1Ii += " " + list.type + " " + list.dayNum + "天, " + list.quantity + list.unit + "\n";
} else {
lIliI1Ii += " " + list.type + ", " + list.quantity + list.unit + "\n";
}
break;
case "CartItem":
lIliI1Ii += " " + list.replace(/[^(加购)\d+]\S+(?=\d+)/g, "件 ") + "\n";
@ -3884,7 +3915,7 @@ class Iii1iI1i {
switch (body.activityType) {
case 3:
case 4:
if (lIliI1Ii.includes(list.name)) continue;
if (msg.includes(list.name)) continue;
lIliI1Ii += " " + "奖品名称:" + list.name + ",数量:" + list.totalNum + "\n";
break;
case 5:
@ -3898,7 +3929,7 @@ class Iii1iI1i {
case 129:
if (list.name) {
list = list.name;
if (lIliI1Ii.includes(list)) continue
if (msg.includes(list)) continue
}
lIliI1Ii += " " + list + "\n";
break;
@ -3910,7 +3941,7 @@ class Iii1iI1i {
break;
case 10020:
case 30003:
if (lIliI1Ii.includes(list.prizeName)) continue
if (msg.includes(list.prizeName)) continue
lIliI1Ii += " " + list.prizeName + "\n";
break;
case 25: