This commit is contained in:
董海洋
2026-06-04 09:39:39 +08:00
parent 171e2365f3
commit 9cf2e00031
+3 -3
View File
@@ -60,9 +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)) const limitStr = String(ctx.query.limit).trim()
sql += ' LIMIT ?' const limit = Math.min(10000, Math.max(1, isNaN(parseInt(limitStr)) ? 20 : parseInt(limitStr)))
params.push(limit) sql += ' LIMIT ' + 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