From 5996d9a24608c8a2472c6237bbcd4e75295bf3fd Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 5 Sep 2024 13:54:02 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=90=9C=E7=B4=A2=E9=85=92=E5=BA=97:?= =?UTF-8?q?=20=E5=85=B3=E9=94=AE=E8=AF=8D=E5=AD=97=E7=AC=A6=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/controllers/api.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/controllers/api.js b/server/controllers/api.js index e990bfa..79f18f2 100644 --- a/server/controllers/api.js +++ b/server/controllers/api.js @@ -16,7 +16,12 @@ class Api extends BaseController { const { limit, offset } = this.getPagination(page, size); - const { rows, count } = await heytripService.hotelSearch(keyword, { limit, offset }); + let keywordStr = keyword; + keywordStr = keyword.replace(/[,’'"\\;%()@&+=\-\.®–\!]/g, ''); // '[^a-zA-Z0-9 @@&&()\-\./®’"'',–\!]' + keywordStr = keywordStr.replace(/\s+/g, ' '); + keywordStr = keywordStr.trim(); + + const { rows, count } = await heytripService.hotelSearch(keywordStr, { limit, offset }); let quoteRes = [];