From 3e2d6bdd362ab3a144a2016d573540b2b441a66e Mon Sep 17 00:00:00 2001 From: Minho Date: Fri, 5 May 2017 11:09:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=81=E6=9C=89=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/document.go | 2 +- models/book.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/controllers/document.go b/controllers/document.go index e6ee92ef..0d15681f 100644 --- a/controllers/document.go +++ b/controllers/document.go @@ -51,7 +51,7 @@ func isReadable (identify,token string,c *DocumentController) *models.BookResult } else if token, ok := c.GetSession(identify).(string); !ok || !strings.EqualFold(token, book.PrivateToken) { c.Abort("403") } - } else { + } else if !is_ok { c.Abort("403") } diff --git a/models/book.go b/models/book.go index e9682a26..eda3139a 100644 --- a/models/book.go +++ b/models/book.go @@ -64,7 +64,7 @@ func NewBook() *Book { func (m *Book) Insert() error { o := orm.NewOrm() - o.Begin() +// o.Begin() _,err := o.Insert(m) @@ -76,7 +76,7 @@ func (m *Book) Insert() error { err = relationship.Insert() if err != nil { logs.Error("插入项目与用户关联 => ",err) - o.Rollback() + //o.Rollback() return err } document := NewDocument() @@ -85,13 +85,13 @@ func (m *Book) Insert() error { document.MemberId = m.MemberId err = document.InsertOrUpdate() if err != nil{ - o.Rollback() + //o.Rollback() return err } - o.Commit() + //o.Commit() return nil } - o.Rollback() + //o.Rollback() return err }