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) {
|
func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterToken) (*FsUser, error) {
|
||||||
user := &FsUser{}
|
user := &FsUser{}
|
||||||
|
|
||||||
|
logcontent := ""
|
||||||
|
defer func() {
|
||||||
|
logx.Info("aaaa:", logcontent)
|
||||||
|
}()
|
||||||
|
|
||||||
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
|
||||||
defer func() {
|
defer func() {
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
UserTx := tx.Model(user)
|
UserTx := tx.Model(user)
|
||||||
|
@ -166,7 +172,7 @@ 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
|
||||||
logx.Info("create")
|
logcontent += "create."
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -192,17 +198,31 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||||
Ctime: &now,
|
Ctime: &now,
|
||||||
Utime: &now,
|
Utime: &now,
|
||||||
}
|
}
|
||||||
|
logcontent += "profile."
|
||||||
return txUserInfo.Create(uinfo).Error
|
return txUserInfo.Create(uinfo).Error
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err == gorm.ErrRecordNotFound {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err == gorm.ErrRecordNotFound {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return fmt.Errorf("the email had registered")
|
return fmt.Errorf("the email had registered")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err == gorm.ErrRecordNotFound {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user