From 1ed2346303b8b1f4ebae1057b9dc9f9302f50829 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Tue, 29 Aug 2023 16:07:47 +0800 Subject: [PATCH] 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 50d5227c..76f36d3c 100644 --- a/model/gmodel/fs_user_logic.go +++ b/model/gmodel/fs_user_logic.go @@ -141,8 +141,9 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT user = &FsUser{} var err error - UserTx := tx.Model(user) - err = UserTx.Where("email = ?", token.Email).Take(user).Error + + userTx := tx.Model(user) + err = userTx.Where("email = ?", token.Email).Take(user).Error if err == gorm.ErrRecordNotFound { @@ -151,13 +152,14 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT Resetaurant := token.Extend["resetaurant"].(string) createAt := time.Now().UTC().Unix() + user.Email = &token.Email user.CreatedAt = &createAt user.PasswordHash = &token.Password user.FirstName = &FirstName user.LastName = &LastName - err = UserTx.Create(user).Error + err = tx.Model(user).Create(user).Error if err != nil && err != gorm.ErrRecordNotFound { logx.Error(err) return err