From e3fca11f9986fc55f6bd4e66aafbd91e7d511bb1 Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Fri, 10 Nov 2023 00:46:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A4=E7=89=8Cbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/token.go | 2 +- web/src/components/TokensTable.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/model/token.go b/model/token.go index 9121ca4..41746d9 100644 --- a/model/token.go +++ b/model/token.go @@ -33,7 +33,7 @@ func SearchUserTokens(userId int, keyword string, token string) (tokens []*Token if token != "" { token = strings.Trim(token, "sk-") } - err = DB.Where("user_id = ?", userId).Where("name LIKE ? or key LIKE ?", keyword+"%", token+"%").Find(&tokens).Error + err = DB.Where("user_id = ?", userId).Where("name LIKE ?", keyword+"%").Where("key LIKE ?", token+"%").Find(&tokens).Error return tokens, err } diff --git a/web/src/components/TokensTable.js b/web/src/components/TokensTable.js index b04fb84..d44e606 100644 --- a/web/src/components/TokensTable.js +++ b/web/src/components/TokensTable.js @@ -377,14 +377,14 @@ const TokensTable = () => { }; const searchTokens = async () => { - if (searchKeyword === '') { + if (searchKeyword === '' && searchToken === '') { // if keyword is blank, load files instead. await loadTokens(0); setActivePage(1); return; } setSearching(true); - const res = await API.get(`/api/token/search?keyword=${searchKeyword}`); + const res = await API.get(`/api/token/search?keyword=${searchKeyword}&token=${searchToken}`); const {success, message, data} = res.data; if (success) { setTokensFormat(data);