fix: 新手礼包接口报错
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user