From 8e1c5412d69a0d5e8b71c401345c009f3cfc79e6 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Thu, 4 Jan 2024 22:20:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E7=A0=B4=E5=86=B0=E7=A4=BC=E5=8C=85?= =?UTF-8?q?=E4=B8=80=E9=94=AE=E9=A2=86=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/pobinglibao/ApiReceive.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/api_s2c/event/pobinglibao/ApiReceive.ts b/src/api_s2c/event/pobinglibao/ApiReceive.ts index a37404f..42296c4 100644 --- a/src/api_s2c/event/pobinglibao/ApiReceive.ts +++ b/src/api_s2c/event/pobinglibao/ApiReceive.ts @@ -27,11 +27,12 @@ export default async function (call: ApiCall) { if (!payLog || !payLog.length) continue; for (let key of ["prize", "recPrize1", "recPrize2"]) { - if (data.record[gift.id] && data.record[gift.id].includes(key)) { - push.concat(key); - prize.concat(gift[key]); + if (!data.record[gift.id] || !data.record[gift.id].includes(key)) { + push.push(key); + prize.push(...gift[key]); } } + if (push.length > 0) { if (update["$push"]) { update["$push"]["record." + gift.id] = { $each: push } From da37b162d9ddcea3cfc0e8003ca715cace1b18b9 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Thu, 4 Jan 2024 22:25:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E7=A0=B4=E5=86=B0=E7=A4=BC=E5=8C=85?= =?UTF-8?q?=E4=B8=80=E9=94=AE=E9=A2=86=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/pobinglibao/ApiReceive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_s2c/event/pobinglibao/ApiReceive.ts b/src/api_s2c/event/pobinglibao/ApiReceive.ts index 42296c4..65ddd8c 100644 --- a/src/api_s2c/event/pobinglibao/ApiReceive.ts +++ b/src/api_s2c/event/pobinglibao/ApiReceive.ts @@ -27,7 +27,7 @@ export default async function (call: ApiCall) { if (!payLog || !payLog.length) continue; for (let key of ["prize", "recPrize1", "recPrize2"]) { - if (!data.record[gift.id] || !data.record[gift.id].includes(key)) { + if (!data || !data?.record[gift.id] || !data.record[gift.id].includes(key)) { push.push(key); prize.push(...gift[key]); }