mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-12-21 11:13:57 +08:00
增加清理附件按钮,对悬空无引用的图片/附件进行清理 (#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:
@@ -309,3 +309,23 @@ func (m *DocumentSearchResult) SearchDocument(keyword string, bookId int) (docs
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 所有项目搜索.
|
||||
func (m *DocumentSearchResult) SearchAllDocument(keyword string) (docs []*DocumentSearchResult, err error) {
|
||||
o := orm.NewOrm()
|
||||
|
||||
sql := "SELECT * FROM md_documents WHERE (document_name LIKE ? OR `release` LIKE ?) "
|
||||
keyword = "%" + keyword + "%"
|
||||
|
||||
_need_escape := need_escape(keyword)
|
||||
escape_sql := func(sql string) string {
|
||||
if _need_escape {
|
||||
return escape_re.ReplaceAllString(sql, escape_replace)
|
||||
}
|
||||
return sql
|
||||
}
|
||||
|
||||
_, err = o.Raw(escape_sql(sql), keyword, keyword).QueryRows(&docs)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user