MCPcopy Index your code
hub / github.com/TruthHun/BookStack / RelatedBook

Method RelatedBook

controllers/api/CommonController.go:1150–1168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1148}
1149
1150func (this *CommonController) RelatedBook() {
1151 bookId := this.getBookIdByIdentify(this.GetString("identify"))
1152 if bookId <= 0 {
1153 this.Response(http.StatusBadRequest, messageBadRequest)
1154 }
1155 res := models.NewRelateBook().Lists(bookId)
1156 var books []APIBook
1157 for _, item := range res {
1158 book := APIBook{}
1159 utils.CopyObject(&item, &book)
1160 book.Cover = this.completeLink(utils.ShowImg(book.Cover, "cover"))
1161 books = append(books, book)
1162 }
1163 data := map[string]interface{}{"books": []string{}}
1164 if len(books) > 0 {
1165 data["books"] = books
1166 }
1167 this.Response(http.StatusOK, messageSuccess, data)
1168}
1169
1170// 查询最近阅读过的书籍,返回最近50本
1171func (this *CommonController) HistoryReadBook() {

Callers

nothing calls this directly

Calls 8

NewRelateBookFunction · 0.92
CopyObjectFunction · 0.92
ShowImgFunction · 0.92
getBookIdByIdentifyMethod · 0.80
ResponseMethod · 0.80
completeLinkMethod · 0.80
appendFunction · 0.50
ListsMethod · 0.45

Tested by

no test coverage detected