feat: 中间件校验时预加载用户信息

main
熊二 2 years ago
parent dcaf54a67a
commit 96a717a9e9
  1. 2
      app/fns.go

@ -117,7 +117,7 @@ func CheckAuthToken(next http.Handler) http.Handler {
NewResponseWriter(w).Error(ErrInvalidToken)
} else {
var ut UserToken
err = DB.First(&ut, "code = ?", codeString).Error
err = DB.Model(&UserToken{}).Preload("User").First(&ut, "code = ?", codeString).Error
if err != nil {
NewResponseWriter(w).Error(ErrInvalidToken)
} else {

Loading…
Cancel
Save