diff --git a/src/admin/controllers/shop.controller.ts b/src/admin/controllers/shop.controller.ts index 2dd3c9f..093b816 100644 --- a/src/admin/controllers/shop.controller.ts +++ b/src/admin/controllers/shop.controller.ts @@ -4,6 +4,7 @@ import { Shop } from '../../models/shop/Shop' import { ZError } from '../../common/ZError' import { Game } from '../../models/content/Game' import { generateQrFile } from '../../services/File' +import { isObjectId } from '../../utils/string.util' class ShopController extends BaseController { @@ -155,6 +156,13 @@ class ShopController extends BaseController { @router('post /shop/gameqr') async getGameQr(req: any) { let { shop, gameId, version } = req.params + if (isObjectId(shop)) { + let record = await Shop.findById(shop) + if (!record) { + throw new ZError(12, 'shop not found') + } + shop = record.sid + } const { url } = await generateQrFile({gameId, version, shop}) return { url } }