mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-28 21:39:06 +08:00
fix: 解决启动之后报错的BUG
This commit is contained in:
parent
ae295794d3
commit
decb4bb16b
@ -62,17 +62,14 @@ func (a *AppInstallRepo) WithIdNotInWebsite() DBOption {
|
|||||||
func (a *AppInstallRepo) ListBy(opts ...DBOption) ([]model.AppInstall, error) {
|
func (a *AppInstallRepo) ListBy(opts ...DBOption) ([]model.AppInstall, error) {
|
||||||
var install []model.AppInstall
|
var install []model.AppInstall
|
||||||
db := getDb(opts...).Model(&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
|
return install, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AppInstallRepo) GetFirst(opts ...DBOption) (model.AppInstall, error) {
|
func (a *AppInstallRepo) GetFirst(opts ...DBOption) (model.AppInstall, error) {
|
||||||
var install model.AppInstall
|
var install model.AppInstall
|
||||||
db := getDb(opts...).Model(&model.AppInstall{})
|
db := getDb(opts...).Model(&model.AppInstall{})
|
||||||
err := db.Preload("App").Preload("Backups", func(db *gorm.DB) *gorm.DB {
|
err := db.Preload("App").First(&install).Error
|
||||||
db = db.Order("created_at desc")
|
|
||||||
return db
|
|
||||||
}).First(&install).Error
|
|
||||||
return install, err
|
return install, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +96,7 @@ func (a *AppInstallRepo) Page(page, size int, opts ...DBOption) (int64, []model.
|
|||||||
db := getDb(opts...).Model(&model.AppInstall{})
|
db := getDb(opts...).Model(&model.AppInstall{})
|
||||||
count := int64(0)
|
count := int64(0)
|
||||||
db = db.Count(&count)
|
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
|
return count, apps, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user