diff --git a/model/gmodel/fs_user_logic.go b/model/gmodel/fs_user_logic.go index bf8050ca..243c533f 100644 --- a/model/gmodel/fs_user_logic.go +++ b/model/gmodel/fs_user_logic.go @@ -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 })