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[]