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,