From ca9c8d22e29a3498d5ce74db8bc7b5332dd50893 Mon Sep 17 00:00:00 2001 From: guanchao <18612113337@163.com> Date: Sat, 10 Oct 2026 19:20:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=88=98=E4=BB=A4=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E6=97=B6=E6=9C=AA=E8=A6=86=E7=9B=96=E5=88=B0=E6=9C=AA=E8=A7=A3?= =?UTF-8?q?=E9=94=81=E5=A5=96=E5=8A=B1=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E9=A2=86=E5=8F=96=E7=BB=93=E7=AE=97=E5=A5=96?= =?UTF-8?q?=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- laf-cloud/functions/passCheckSettlement.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/laf-cloud/functions/passCheckSettlement.ts b/laf-cloud/functions/passCheckSettlement.ts index 06097ba..47154d3 100644 --- a/laf-cloud/functions/passCheckSettlement.ts +++ b/laf-cloud/functions/passCheckSettlement.ts @@ -46,8 +46,10 @@ export function expiredSnapshots(user: any, now = Date.now()): any { for (const key of Object.keys(stages)) { const stage = stages[key], end = Number(stage?.time || key); if (!end || end > now || result[String(end)]) continue; - result[String(end)] = { end, stage: copy({ ...stage, time: String(end) }), frozenAt: now, - claimed: false, emptySeen: false, offer: 'unused' }; + result[String(end)] = { + end, stage: copy({ ...stage, time: String(end) }), frozenAt: now, + claimed: false, emptySeen: false, offer: 'unused' + }; } return result; } @@ -87,8 +89,10 @@ async function flushPending(user: any, table: string): Promise { * can commit until that receipt has been durably copied to the independent archive. */ export async function commitUserSettlement(user: any, row: any, patch: any, expected: any, table = 'users', unset: any = {}): Promise { const revision = (Number(user.passSettlementRevision) || 0) + 1; - const written = await collection(table).updateOne({ ...expected, _id: user._id, - passSettlementRevision: user.passSettlementRevision ?? null, passSettlementPending: null }, { + const written = await collection(table).updateOne({ + ...expected, _id: user._id, + passSettlementRevision: user.passSettlementRevision ?? null, passSettlementPending: null + }, { $set: { ...patch, passSettlementRevision: revision, passSettlementPending: { revision, row } }, ...(Object.keys(unset).length ? { $unset: unset } : {}) }); @@ -184,7 +188,7 @@ export async function mutateSettlement(user: any, body: any, table = 'users'): P rewards = normalizeRewards(body.rewards); if (body.claimFlags) for (const lane of purchase ? ['passCheck'] : ['free', 'passCheck']) { const flags = body.claimFlags[lane]; - if (!Array.isArray(flags) || flags.length > 10000 || flags.some(v => v !== 0 && v !== 1 && v !== null)) fail('领取记录无效', 400); + if (!Array.isArray(flags) || flags.length > 10000 || flags.some(v => v !== 0 && v !== -1 && v !== 1 && v !== null)) fail('领取记录无效', 400); next.stage[lane] = [...(next.stage[lane] || [])]; flags.forEach((v, i) => { if (v === 0) next.stage[lane][i] = 0; }); }