add err for RegisterByOauth

This commit is contained in:
Tao Chen
2024-11-03 16:49:03 +08:00
parent 3cd90c8f74
commit da7b70c471
2 changed files with 9 additions and 8 deletions

View File

@@ -208,9 +208,9 @@ func (o *Oauth) OauthCallback(c *gin.Context) {
}
//自动注册
user = service.AllService.UserService.RegisterByOauth(oauthUser, op)
if user.Id == 0 {
c.String(http.StatusInternalServerError, response.TranslateMsg(c, "OauthRegisterFailed"))
err, user = service.AllService.UserService.RegisterByOauth(oauthUser, op)
if err != nil {
c.String(http.StatusInternalServerError, response.TranslateMsg(c, err.Error()))
return
}
}