From c656acb8fb8c4daaaeb15cd5af481c2f1811c310 Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 22 Jan 2021 15:18:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BF=9D=E5=AD=98=E5=8D=A1?= =?UTF-8?q?=E7=BB=84=E9=80=BB=E8=BE=91,=20=E9=BB=98=E8=AE=A4=E5=8D=A1?= =?UTF-8?q?=E7=BB=84=E4=B8=8D=E8=83=BD=E4=BF=AE=E6=94=B9,=20=E4=B8=8D?= =?UTF-8?q?=E5=8D=A0slot=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CardController.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/controllers/CardController.ts b/src/controllers/CardController.ts index 0399a06..ee54078 100644 --- a/src/controllers/CardController.ts +++ b/src/controllers/CardController.ts @@ -68,10 +68,18 @@ export default class CardController extends BaseController { throw new ZError(103, '卡组已被删除') } if (!record) { + let count = await CardGroup.count({accountid, isdefault: false, deleted: false}) + let account = req.user + if (count >= account.slot) { + throw new ZError(105, '英雄可使用的卡槽数量不足') + } record = new CardGroup() record.accountid = accountid record.isdefault = false } + if (record.isdefault) { + throw new ZError(104, '默认卡组不能修改') + } if (selected) { await CardGroup.updateMany({ accountid,