From 2c323c9688f5a6435ad33f9324bd67c2e35bbde9 Mon Sep 17 00:00:00 2001 From: zhl Date: Sun, 25 Apr 2021 14:37:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=97=E9=93=BA=E9=A2=98?= =?UTF-8?q?=E5=BA=93=E7=B1=BB=E5=9E=8B=E9=80=89=E6=8B=A9=E7=9A=84=E4=BF=9D?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/controllers/shop.controller.ts | 15 +++++++++++++++ src/models/shop/Shop.ts | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/admin/controllers/shop.controller.ts b/src/admin/controllers/shop.controller.ts index 4caea11..dde1104 100644 --- a/src/admin/controllers/shop.controller.ts +++ b/src/admin/controllers/shop.controller.ts @@ -119,4 +119,19 @@ class ShopController extends BaseController { versionid: shop.gameInfo.versionid } } + @permission('shop:edit') + @router('post /shop/save_qtype') + async updateQTypes(req, res) { + let { shopid, qtypes } = req.params + if (!shopid) { + throw new ZError(11, 'params mismatch') + } + let shop = await Shop.findById(shopid) + if (!shop) { + throw new ZError(12, 'shop not found') + } + shop.qtypes = qtypes + await shop.save() + return {} + } } diff --git a/src/models/shop/Shop.ts b/src/models/shop/Shop.ts index 0e8075d..e5c0824 100644 --- a/src/models/shop/Shop.ts +++ b/src/models/shop/Shop.ts @@ -102,7 +102,10 @@ class ShopClass extends BaseModule { */ @prop() public gameInfo?: GameInfo - + /** + * 已选择的题库分类 + * @type {string[]} + */ @prop() public qtypes: string[]