修复令牌添加、搜索bug

This commit is contained in:
CaIon
2023-11-25 17:30:36 +08:00
parent fe360c0676
commit 3121afd2e0
2 changed files with 5 additions and 3 deletions

View File

@@ -34,7 +34,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 ?", keyword+"%").Where("`key` LIKE ?", token+"%").Find(&tokens).Error
err = DB.Where("user_id = ?", userId).Where("name LIKE ?", "%"+keyword+"%").Where("`key` LIKE ?", "%"+token+"%").Find(&tokens).Error
return tokens, err
}