From d884624aad6fb40f7c0bca5a116d79e4055d380b Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Tue, 29 Aug 2023 15:15:39 +0800 Subject: [PATCH 1/2] fix --- model/gmodel/fs_user_logic.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model/gmodel/fs_user_logic.go b/model/gmodel/fs_user_logic.go index f331bec8..16f12b89 100644 --- a/model/gmodel/fs_user_logic.go +++ b/model/gmodel/fs_user_logic.go @@ -145,6 +145,7 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT err := u.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error { var err error + UserTx := tx.Model(user) err = UserTx.Where("email = ?", token.Email).Take(user).Error if err == gorm.ErrRecordNotFound { @@ -203,6 +204,7 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT }) logcontent += "end" + logx.Error(err) if err != nil && err != gorm.ErrRecordNotFound { return nil, err } From 0977c8aed21cec2722938ba1d3a71a37cdc9f45e Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Tue, 29 Aug 2023 15:17:51 +0800 Subject: [PATCH 2/2] fix --- model/gmodel/fs_user_logic.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/model/gmodel/fs_user_logic.go b/model/gmodel/fs_user_logic.go index 16f12b89..74fc6a00 100644 --- a/model/gmodel/fs_user_logic.go +++ b/model/gmodel/fs_user_logic.go @@ -136,14 +136,17 @@ type UserProfile struct { // 自平台的注册流程 func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterToken) (*FsUser, error) { + + var err error + user := &FsUser{} logcontent := "" defer func() { - logx.Info("aaaa:", logcontent) + logx.Info("aaaa:", logcontent, err) }() - 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 UserTx := tx.Model(user) @@ -204,7 +207,6 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT }) logcontent += "end" - logx.Error(err) if err != nil && err != gorm.ErrRecordNotFound { return nil, err }