chore!(all): update go import path

BREAKING CHANGE: use github.com/mindoc-org/mindoc as import path
This commit is contained in:
roberChen
2021-03-23 15:09:17 +08:00
parent 886bc8ee51
commit 79f70d830d
54 changed files with 279 additions and 248 deletions

View File

@@ -10,8 +10,8 @@ import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/lifei6671/mindoc/conf"
"github.com/lifei6671/mindoc/utils/filetil"
"github.com/mindoc-org/mindoc/conf"
"github.com/mindoc-org/mindoc/utils/filetil"
)
// Attachment struct .
@@ -82,11 +82,12 @@ func (m *Attachment) Find(id int) (*Attachment, error) {
return m, err
}
//查询指定文档的附件列表
func (m *Attachment) FindListByDocumentId(docId int) (attaches []*Attachment, err error) {
o := orm.NewOrm()
_, err = o.QueryTable(m.TableNameWithPrefix()).Filter("document_id", docId).Filter("book_id__gt",0).OrderBy("-attachment_id").All(&attaches)
_, err = o.QueryTable(m.TableNameWithPrefix()).Filter("document_id", docId).Filter("book_id__gt", 0).OrderBy("-attachment_id").All(&attaches)
return
}
@@ -109,7 +110,7 @@ func (m *Attachment) FindToPager(pageIndex, pageSize int) (attachList []*Attachm
if err != nil {
if err == orm.ErrNoRows {
beego.Info("没有查到附件 ->",err)
beego.Info("没有查到附件 ->", err)
err = nil
}
return
@@ -122,12 +123,12 @@ func (m *Attachment) FindToPager(pageIndex, pageSize int) (attachList []*Attachm
//当项目ID为0标识是文章的附件
if item.BookId == 0 && item.DocumentId > 0 {
blog := NewBlog()
if err := o.QueryTable(blog.TableNameWithPrefix()).Filter("blog_id",item.DocumentId).One(blog,"blog_title");err == nil {
if err := o.QueryTable(blog.TableNameWithPrefix()).Filter("blog_id", item.DocumentId).One(blog, "blog_title"); err == nil {
attach.BookName = blog.BlogTitle
}else{
} else {
attach.BookName = "[文章不存在]"
}
}else {
} else {
book := NewBook()
if e := o.QueryTable(book.TableNameWithPrefix()).Filter("book_id", item.BookId).One(book, "book_name"); e == nil {