修复BUG

This commit is contained in:
Minho
2017-06-05 13:41:47 +08:00
parent 8a4eabd158
commit 95c63fb1fb
2 changed files with 12 additions and 12 deletions

View File

@@ -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
}