fix
This commit is contained in:
parent
6baf9cd19c
commit
122c850d2e
|
@ -140,12 +140,18 @@ type UserProfile struct {
|
|||
func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterToken) (*FsUser, error) {
|
||||
user := &FsUser{}
|
||||
|
||||
logcontent := ""
|
||||
defer func() {
|
||||
logx.Info("aaaa:", logcontent)
|
||||
}()
|
||||
|
||||
err := u.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
var err error
|
||||
defer func() {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
err = nil
|
||||
}
|
||||
|
||||
}()
|
||||
|
||||
UserTx := tx.Model(user)
|
||||
|
@ -166,7 +172,7 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
|||
user.LastName = &LastName
|
||||
|
||||
err = UserTx.Create(user).Error
|
||||
logx.Info("create")
|
||||
logcontent += "create."
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -192,17 +198,31 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
|||
Ctime: &now,
|
||||
Utime: &now,
|
||||
}
|
||||
logcontent += "profile."
|
||||
return txUserInfo.Create(uinfo).Error
|
||||
})
|
||||
}
|
||||
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
err = nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
err = nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
return fmt.Errorf("the email had registered")
|
||||
}
|
||||
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
err = nil
|
||||
}
|
||||
return err
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user