限制 10000
This commit is contained in:
@@ -60,8 +60,9 @@ async function getGoods(ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.query.limit && !ctx.query.page) {
|
if (ctx.query.limit && !ctx.query.page) {
|
||||||
|
const limit = Math.min(10000, Math.max(1, parseInt(ctx.query.limit) || 20))
|
||||||
sql += ' LIMIT ?'
|
sql += ' LIMIT ?'
|
||||||
params.push(parseInt(ctx.query.limit))
|
params.push(limit)
|
||||||
const goods = await query(sql, params)
|
const goods = await query(sql, params)
|
||||||
ctx.body = { code: 200, data: processGoodsImages(goods) }
|
ctx.body = { code: 200, data: processGoodsImages(goods) }
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user