fix: fix MySQL syntax error (#54)

This commit is contained in:
JustSong
2023-04-27 11:10:10 +08:00
parent 5bfc224669
commit 195e94a75d
2 changed files with 2 additions and 2 deletions

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 状态不可用")