From decb4bb16bea7d4f86479564b803dd4fc68a546c Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Thu, 2 Mar 2023 18:47:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E6=8A=A5=E9=94=99=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/repo/app_install.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/app/repo/app_install.go b/backend/app/repo/app_install.go index c5e0f6990..79b526cff 100644 --- a/backend/app/repo/app_install.go +++ b/backend/app/repo/app_install.go @@ -62,17 +62,14 @@ func (a *AppInstallRepo) WithIdNotInWebsite() DBOption { func (a *AppInstallRepo) ListBy(opts ...DBOption) ([]model.AppInstall, error) { var install []model.AppInstall db := getDb(opts...).Model(&model.AppInstall{}) - err := db.Preload("App").Preload("Backups").Find(&install).Error + err := db.Preload("App").Find(&install).Error return install, err } func (a *AppInstallRepo) GetFirst(opts ...DBOption) (model.AppInstall, error) { var install model.AppInstall db := getDb(opts...).Model(&model.AppInstall{}) - err := db.Preload("App").Preload("Backups", func(db *gorm.DB) *gorm.DB { - db = db.Order("created_at desc") - return db - }).First(&install).Error + err := db.Preload("App").First(&install).Error return install, err } @@ -99,7 +96,7 @@ func (a *AppInstallRepo) Page(page, size int, opts ...DBOption) (int64, []model. db := getDb(opts...).Model(&model.AppInstall{}) count := int64(0) db = db.Count(&count) - err := db.Limit(size).Offset(size * (page - 1)).Preload("App").Preload("Backups").Find(&apps).Error + err := db.Limit(size).Offset(size * (page - 1)).Preload("App").Find(&apps).Error return count, apps, err }