This commit is contained in:
eson 2023-09-05 16:16:57 +08:00
parent b3fcf0c77c
commit d9de812728
2 changed files with 3 additions and 2 deletions

View File

@ -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的资源表

View File

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