From f1b199b16c9958df8c9ddafe0e6e11d7cc2144e8 Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 9 Jun 2021 10:14:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BA=97=E9=93=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E8=8E=B7=E5=8F=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/controllers/shop.controller.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/controllers/shop.controller.ts b/src/api/controllers/shop.controller.ts index 7d5664b..76976bb 100644 --- a/src/api/controllers/shop.controller.ts +++ b/src/api/controllers/shop.controller.ts @@ -95,11 +95,11 @@ class ShopController extends BaseController { if (!shop) { throw new ZError(11, '未找到对应的店铺') } - let user = (await GameUser.findOrCreate({ accountId })).doc - user.shop = shop.id - user.shops.pushOnce(shop.id) - user.loginParams = sid.split('|').slice(1) - await user.save() + await GameUser.findOneAndUpdate( + { accountId }, + { shop: shop.id, loginParams: sid.split('_').slice(1) }, + { upsert: true, new: true }, + ) rspData.gameCfg = {} if (!!shop.gameInfo) { let gameInfo = shop.gameInfo