From f497fb7a1a6a318baa89015ca462ff50f0c79384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=9F=E5=B8=85?= <133814250@qq.com> Date: Tue, 3 Sep 2024 17:55:26 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=8D=B8=E8=BD=BD=E6=97=B6=E4=BA=8B=E5=8A=A1?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/internal/library/addons/install.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/internal/library/addons/install.go b/server/internal/library/addons/install.go index 1913fc9..9f673a3 100644 --- a/server/internal/library/addons/install.go +++ b/server/internal/library/addons/install.go @@ -62,10 +62,10 @@ func Install(m Module) (err error) { } return g.DB().Transaction(m.Ctx(), func(ctx context.Context, tx gdb.TX) error { if record != nil { - _, _ = GetModel(m.Ctx()).Where("id", record.Id).Delete() + _, _ = GetModel(ctx).Where("id", record.Id).Delete() } - if _, err = GetModel(m.Ctx()).Data(data).OmitEmptyData().Insert(); err != nil { + if _, err = GetModel(ctx).Data(data).OmitEmptyData().Insert(); err != nil { return err } return m.Install(ctx) @@ -87,7 +87,7 @@ func Upgrade(m Module) (err error) { "version": m.GetSkeleton().Version, } return g.DB().Transaction(m.Ctx(), func(ctx context.Context, tx gdb.TX) error { - if _, err = GetModel(m.Ctx()).Where("id", record.Id).Data(data).Update(); err != nil { + if _, err = GetModel(ctx).Where("id", record.Id).Data(data).Update(); err != nil { return err } return m.Upgrade(ctx) @@ -110,7 +110,7 @@ func UnInstall(m Module) (err error) { "status": consts.AddonsInstallStatusUn, } return g.DB().Transaction(m.Ctx(), func(ctx context.Context, tx gdb.TX) error { - if _, err = GetModel(m.Ctx()).Where("id", record.Id).Data(data).Update(); err != nil { + if _, err = GetModel(ctx).Where("id", record.Id).Data(data).Update(); err != nil { return err } return m.UnInstall(ctx)