fix
This commit is contained in:
parent
0977c8aed2
commit
88e68c3903
|
@ -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 {
|
err = u.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||||
var err error
|
|
||||||
|
|
||||||
|
var err error
|
||||||
UserTx := tx.Model(user)
|
UserTx := tx.Model(user)
|
||||||
err = UserTx.Where("email = ?", token.Email).Take(user).Error
|
err = UserTx.Where("email = ?", token.Email).Take(user).Error
|
||||||
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
|
|
||||||
FirstName := token.Extend["first_name"].(string)
|
FirstName := token.Extend["first_name"].(string)
|
||||||
|
@ -165,7 +166,6 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||||
user.LastName = &LastName
|
user.LastName = &LastName
|
||||||
|
|
||||||
err = UserTx.Create(user).Error
|
err = UserTx.Create(user).Error
|
||||||
|
|
||||||
if err != nil && err != gorm.ErrRecordNotFound {
|
if err != nil && err != gorm.ErrRecordNotFound {
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
return err
|
return err
|
||||||
|
@ -194,7 +194,13 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||||
Utime: &now,
|
Utime: &now,
|
||||||
}
|
}
|
||||||
logcontent += "profile."
|
logcontent += "profile."
|
||||||
return txUserInfo.Create(uinfo).Error
|
|
||||||
|
err = txUserInfo.Create(uinfo).Error
|
||||||
|
if err == gorm.ErrRecordNotFound {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
})
|
})
|
||||||
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user