Skip to content

Commit

Permalink
Refactor panic messages in GetCurrUser and GetCurrUserlevel functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesun committed Oct 9, 2024
1 parent e6711d6 commit 30d48a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func GetCurrUser(c echo.Context) *models.SysOpr {
sess, _ := session.Get(UserSession, c)
username := sess.Values[UserSessionName]
if username == nil || username == "" {
panic("用户未登录")
panic("user not login")
}
user := models.SysOpr{}
err := app.GApp().DB().Where("username = ?", username).First(&user).Error
Expand All @@ -281,7 +281,7 @@ func GetCurrUserlevel(c echo.Context) string {
sess, _ := session.Get(UserSession, c)
level := sess.Values[UserSessionLevel]
if level == nil || level == "" {
panic("用户未登录")
panic("user not login")
}
return level.(string)
}
Expand Down

0 comments on commit 30d48a3

Please sign in to comment.