From c5817b4acff09ecc2fda7f2ba7ab95cadbc6becb Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 13:57:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E9=A2=86=E5=8F=96=E8=AE=B0=E5=BD=95=E7=9A=84=20upsert=20?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiReceive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index 3ceedf5..74d0170 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -94,7 +94,7 @@ export default async function (call: ApiCall) { setObj[zeroTime] = gotAmount; G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, { $set: setObj - }); + }, {upsert: true}); // 记录玩家日志. 仅保留最近 10 条 if (showOff) { G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}});