Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
laodaming 2023-08-29 15:22:02 +08:00
commit d0acec05fa

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 {