This commit is contained in:
eson 2023-08-29 16:07:47 +08:00
parent 7a845bb83f
commit 1ed2346303

View File

@ -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