feat:实现项目密码访问功能

This commit is contained in:
lifei6671
2018-11-14 15:57:55 +08:00
parent 27d42d194c
commit 7b3e4f0672
11 changed files with 228 additions and 135 deletions

View File

@@ -39,6 +39,7 @@ type BookResult struct {
Publisher string `json:"publisher"`
PrivatelyOwned int `json:"privately_owned"`
PrivateToken string `json:"private_token"`
BookPassword string `json:"book_password"`
DocCount int `json:"doc_count"`
CommentStatus string `json:"comment_status"`
CommentCount int `json:"comment_count"`
@@ -93,11 +94,11 @@ func (m *BookResult) FindByIdentify(identify string, memberId int) (*BookResult,
err := NewBook().QueryTable().Filter("identify", identify).One(&book)
if err != nil {
beego.Error("获取项目失败 ->",err)
beego.Error("获取项目失败 ->", err)
return m, err
}
roleId,err := NewBook().FindForRoleId(book.BookId,memberId)
roleId, err := NewBook().FindForRoleId(book.BookId, memberId)
if err != nil {
return m, ErrPermissionDenied
@@ -126,7 +127,6 @@ func (m *BookResult) FindByIdentify(identify string, memberId int) (*BookResult,
m.RealName = member.RealName
}
if m.RoleId == conf.BookFounder {
m.RoleName = "创始人"
} else if m.RoleId == conf.BookAdmin {
@@ -185,6 +185,7 @@ func (m *BookResult) ToBookResult(book Book) *BookResult {
m.Description = strings.Replace(book.Description, "\r\n", "<br/>", -1)
m.PrivatelyOwned = book.PrivatelyOwned
m.PrivateToken = book.PrivateToken
m.BookPassword = book.BookPassword
m.DocCount = book.DocCount
m.CommentStatus = book.CommentStatus
m.CommentCount = book.CommentCount