生成店铺游戏小游戏码时, 强制使用短id
This commit is contained in:
parent
2884da21a8
commit
b50c87cbb9
@ -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 }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user