This commit is contained in:
eson 2023-08-29 15:21:19 +08:00
parent 0977c8aed2
commit 88e68c3903

View File

@ -147,10 +147,11 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
}()
err = u.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
var err error
var err error
UserTx := tx.Model(user)
err = UserTx.Where("email = ?", token.Email).Take(user).Error
if err == gorm.ErrRecordNotFound {
FirstName := token.Extend["first_name"].(string)
@ -165,7 +166,6 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
user.LastName = &LastName
err = UserTx.Create(user).Error
if err != nil && err != gorm.ErrRecordNotFound {
logx.Error(err)
return err
@ -194,7 +194,13 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
Utime: &now,
}
logcontent += "profile."
return txUserInfo.Create(uinfo).Error
err = txUserInfo.Create(uinfo).Error
if err == gorm.ErrRecordNotFound {
return nil
}
return err
})
if err == gorm.ErrRecordNotFound {