mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-10-21 19:37:27 +08:00
修复BUG
This commit is contained in:
@@ -4,11 +4,11 @@ package models
|
||||
import (
|
||||
"time"
|
||||
|
||||
"os"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/orm"
|
||||
"github.com/lifei6671/godoc/conf"
|
||||
"os"
|
||||
"github.com/astaxie/beego"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Attachment struct .
|
||||
@@ -58,7 +58,7 @@ func (m *Attachment) Update() error {
|
||||
func (m *Attachment) Delete() error {
|
||||
o := orm.NewOrm()
|
||||
|
||||
_,err := o.Delete(m)
|
||||
_, err := o.Delete(m)
|
||||
|
||||
if err == nil {
|
||||
if err1 := os.Remove(m.FilePath); err1 != nil {
|
||||
@@ -83,6 +83,6 @@ func (m *Attachment) Find(id int) (*Attachment, error) {
|
||||
func (m *Attachment) FindListByDocumentId(doc_id int) (attaches []*Attachment, err error) {
|
||||
o := orm.NewOrm()
|
||||
|
||||
_,err = o.QueryTable(m.TableNameWithPrefix()).Filter("document_id",doc_id).OrderBy("-attachment_id").All(&attaches)
|
||||
_, err = o.QueryTable(m.TableNameWithPrefix()).Filter("document_id", doc_id).OrderBy("-attachment_id").All(&attaches)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user