Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 当前用户没有权限的情况下设置成了创始人(数字:0) #847

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions models/BookResult.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (m *BookResult) FindToPager(pageIndex, pageSize int) (books []*BookResult,
return
}

//实体转换
// 实体转换
func (m *BookResult) ToBookResult(book Book) *BookResult {

m.BookId = book.BookId
Expand Down Expand Up @@ -214,6 +214,7 @@ func (m *BookResult) ToBookResult(book Book) *BookResult {
m.IsDownload = book.IsDownload == 0
m.AutoSave = book.AutoSave == 1
m.ItemId = book.ItemId
m.RoleId = conf.BookRoleNoSpecific

if book.Theme == "" {
m.Theme = "default"
Expand Down Expand Up @@ -249,12 +250,13 @@ func (m *BookResult) ToBookResult(book Book) *BookResult {
} else if m.CommentStatus == "group_only" {
// todo
} else {
m.IsDisplayComment = false;
m.IsDisplayComment = false
}

return m
}

//后台转换
// 后台转换
func BackgroundConvert(sessionId string, bookResult *BookResult) error {

if err := converter.CheckConvertCommand(); err != nil {
Expand All @@ -274,7 +276,7 @@ func BackgroundConvert(sessionId string, bookResult *BookResult) error {
return nil
}

//导出PDF、word等格式
// 导出PDF、word等格式
func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {

convertBookResult := ConvertBookResult{}
Expand Down Expand Up @@ -521,7 +523,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
return convertBookResult, nil
}

//导出Markdown原始文件
// 导出Markdown原始文件
func (m *BookResult) ExportMarkdown(sessionId string) (string, error) {
outputPath := filepath.Join(conf.WorkingDirectory, "uploads", "books", strconv.Itoa(m.BookId), "book.zip")

Expand All @@ -546,7 +548,7 @@ func (m *BookResult) ExportMarkdown(sessionId string) (string, error) {
return outputPath, nil
}

//递归导出Markdown文档
// 递归导出Markdown文档
func exportMarkdown(p string, parentId int, bookId int, baseDir string, bookUrl string) error {
o := orm.NewOrm()

Expand Down Expand Up @@ -709,7 +711,7 @@ func recursiveJoinDocumentIdentify(parentDocId int, identify string) string {
return identify
}

//查询项目的第一篇文档
// 查询项目的第一篇文档
func (m *BookResult) FindFirstDocumentByBookId(bookId int) (*Document, error) {

o := orm.NewOrm()
Expand Down