mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-12-19 19:57:09 +08:00
实现文档缓存
This commit is contained in:
@@ -834,23 +834,23 @@ func (c *DocumentController) Content() {
|
||||
|
||||
c.JsonResult(0, "ok", doc)
|
||||
}
|
||||
|
||||
func (c *DocumentController) GetDocumentById(id string) (doc *models.Document, err error) {
|
||||
doc = models.NewDocument()
|
||||
if doc_id, err := strconv.Atoi(id); err == nil {
|
||||
doc, err = doc.Find(doc_id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
doc, err = doc.FindByFieldFirst("identify", id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return doc, nil
|
||||
}
|
||||
//
|
||||
//func (c *DocumentController) GetDocumentById(id string) (doc *models.Document, err error) {
|
||||
// doc = models.NewDocument()
|
||||
// if doc_id, err := strconv.Atoi(id); err == nil {
|
||||
// doc, err = doc.Find(doc_id)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// } else {
|
||||
// doc, err = doc.FindByFieldFirst("identify", id)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return doc, nil
|
||||
//}
|
||||
|
||||
// 导出
|
||||
func (c *DocumentController) Export() {
|
||||
|
||||
Reference in New Issue
Block a user