实现文档缓存

This commit is contained in:
Minho
2018-02-27 17:20:42 +08:00
parent 405a9c309f
commit 849058ff8a
6 changed files with 323 additions and 38 deletions

View File

@@ -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() {