增加清理附件按钮,对悬空无引用的图片/附件进行清理 (#918)

* add attach_clean & change_theme

* add attach_clean & change_theme

* add

* add readme

---------

Co-authored-by: root <root@DESKTOP-L84EQPB.localdomain>
This commit is contained in:
Sharklet
2023-12-19 13:19:31 +08:00
committed by GitHub
parent 0dbb5d7967
commit 71b8e528ff
13 changed files with 200 additions and 18 deletions

View File

@@ -102,11 +102,15 @@ func (m *Attachment) FindToPager(pageIndex, pageSize int) (attachList []*Attachm
return nil, 0, err
}
totalCount = int(total)
offset := (pageIndex - 1) * pageSize
var list []*Attachment
_, err = o.QueryTable(m.TableNameWithPrefix()).OrderBy("-attachment_id").Offset(offset).Limit(pageSize).All(&list)
offset := (pageIndex - 1) * pageSize
if pageSize == 0 {
_, err = o.QueryTable(m.TableNameWithPrefix()).OrderBy("-attachment_id").Offset(offset).Limit(pageSize).All(&list)
} else {
_, err = o.QueryTable(m.TableNameWithPrefix()).OrderBy("-attachment_id").All(&list)
}
if err != nil {
if err == orm.ErrNoRows {