fix: fix MySQL syntax error (#54)

This commit is contained in:
JustSong
2023-04-27 11:10:10 +08:00
parent a751f30316
commit 4bcc5f54f2
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ func ValidateUserToken(key string) (token *Token, err error) {
}
key = strings.Replace(key, "Bearer ", "", 1)
token = &Token{}
err = DB.Where("key = ?", key).First(token).Error
err = DB.Where("`key` = ?", key).First(token).Error
if err == nil {
if token.Status != common.TokenStatusEnabled {
return nil, errors.New("该 token 状态不可用")