mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-22 20:23:35 +08:00
feat:1、修复无数据时报错的问题。
2、新增自定义代码着色格式 3、新增自动加载配置文件
This commit is contained in:
@@ -180,9 +180,9 @@ func (m *Document) RemoveCache() {
|
||||
func (m *Document) FromCacheById(id int) (*Document, error) {
|
||||
|
||||
var doc Document
|
||||
if err := cache.Get("Document.Id."+strconv.Itoa(id), &m); err == nil {
|
||||
if err := cache.Get("Document.Id."+strconv.Itoa(id), &m); err == nil && m.DocumentId > 0 {
|
||||
m = &doc
|
||||
beego.Info("从缓存中获取文档信息成功", m.DocumentId)
|
||||
beego.Info("从缓存中获取文档信息成功 ->", m.DocumentId)
|
||||
return m, nil
|
||||
}
|
||||
|
||||
@@ -202,8 +202,8 @@ func (m *Document) FromCacheByIdentify(identify string, bookId int) (*Document,
|
||||
|
||||
key := fmt.Sprintf("Document.BookId.%d.Identify.%s", bookId, identify)
|
||||
|
||||
if err := cache.Get(key,m); err == nil {
|
||||
beego.Info("从缓存中获取文档信息成功", key)
|
||||
if err := cache.Get(key,m); err == nil && m.DocumentId > 0 {
|
||||
beego.Info("从缓存中获取文档信息成功 ->", key)
|
||||
return m, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user