diff --git a/laf-cloud/functions/limitedTimeEvent.ts b/laf-cloud/functions/limitedTimeEvent.ts index 9b6dca7..f40cf66 100644 --- a/laf-cloud/functions/limitedTimeEvent.ts +++ b/laf-cloud/functions/limitedTimeEvent.ts @@ -166,11 +166,18 @@ export async function refreshStarterPack(user: any, trigger = false, collection register_time: user.register_time ?? null, levelAmount: user.levelAmount ?? null, ...(options?.reason === "low_coin" ? { coinAmount: user.coinAmount ?? null } : {}), - ...(options?.reason === 'low_health' ? { healthAmount: user.healthAmount ?? null, - userPowerTime: user.userPowerTime ?? null, healthtimestamp: user.healthtimestamp ?? null } : {}), - ...(options?.reason === 'low_props' ? { freezeAmount: user.freezeAmount ?? null, - hammerAmount: user.hammerAmount ?? null, magicAmount: user.magicAmount ?? null } : {}), - }).update(patch); + ...(options?.reason === 'low_health' ? { + healthAmount: user.healthAmount ?? null, + userPowerTime: user.userPowerTime ?? null, healthtimestamp: user.healthtimestamp ?? null + } : {}), + ...(options?.reason === 'low_props' ? { + freezeAmount: user.freezeAmount ?? null, + hammerAmount: user.hammerAmount ?? null, magicAmount: user.magicAmount ?? null + } : {}), + }).update({ + ...patch, + starterPackOffer: db.command.set(patch.starterPackOffer), + }); const fresh = await db.collection(collection).where({ _id: user._id }).getOne(); if (!fresh.data) throw new Error('未获取到玩家数据'); user = fresh.data;