fix: 添加玩家领取记录的 upsert 选项

This commit is contained in:
chenkai 2023-12-22 13:57:02 +08:00
parent 06062716ef
commit c5817b4acf

View File

@ -94,7 +94,7 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
setObj[zeroTime] = gotAmount; setObj[zeroTime] = gotAmount;
G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, { G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, {
$set: setObj $set: setObj
}); }, {upsert: true});
// 记录玩家日志. 仅保留最近 10 条 // 记录玩家日志. 仅保留最近 10 条
if (showOff) { if (showOff) {
G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}}); G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}});