修复私有项目无法编辑的BUG

pull/25/merge
Minho 2017-05-05 11:09:17 +08:00
parent e31561fc7e
commit 3e2d6bdd36
2 changed files with 6 additions and 6 deletions

View File

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

View File

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