From d9de812728c1c27a64100cff81a33a6086e56b64 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Tue, 5 Sep 2023 16:16:57 +0800 Subject: [PATCH] fix --- model/gmodel/fs_user_logic.go | 2 +- server/auth/internal/logic/userresetpasswordlogic.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/model/gmodel/fs_user_logic.go b/model/gmodel/fs_user_logic.go index d4688454..f352abf1 100644 --- a/model/gmodel/fs_user_logic.go +++ b/model/gmodel/fs_user_logic.go @@ -46,7 +46,7 @@ func (u *FsUserModel) FindUserByGoogleId(ctx context.Context, Id int64) (resp Fs } func (u *FsUserModel) Transaction(ctx context.Context, fc func(tx *gorm.DB) error) (err error) { - return u.db.WithContext(ctx).Transaction(fc) + return u.db.Model(&FsUser{}).WithContext(ctx).Transaction(fc) } // 继承guest_id的资源表 diff --git a/server/auth/internal/logic/userresetpasswordlogic.go b/server/auth/internal/logic/userresetpasswordlogic.go index bad9b640..df2d3e90 100644 --- a/server/auth/internal/logic/userresetpasswordlogic.go +++ b/server/auth/internal/logic/userresetpasswordlogic.go @@ -56,8 +56,9 @@ func (l *UserResetPasswordLogic) UserResetPassword(req *types.RequestUserResetPa err = l.svcCtx.AllModels.FsUser.Transaction(l.ctx, func(tx *gorm.DB) error { user := &gmodel.FsUser{Id: int64(rt.UserId)} - err := tx.Model(user).Take(user).Error + err := tx.Take(user).Error if err != nil { + logx.Error(err) return err } if *user.PasswordHash != rt.OldPassword {