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

Method BooksProgress

models/read_record.go:287–301  ·  view source on GitHub ↗

查询阅读进度

(uid int, bookId ...int)

Source from the content-addressed store, hash-verified

285
286// 查询阅读进度
287func (this *ReadRecord) BooksProgress(uid int, bookId ...int) (read map[int]int) {
288 read = make(map[int]int)
289 var count []ReadCount
290 orm.NewOrm().QueryTable(new(ReadCount)).Filter("uid", uid).Filter("book_id__in", bookId).All(&count)
291 for _, item := range count {
292 read[item.BookId] = item.Cnt
293 }
294
295 for _, id := range bookId {
296 if _, ok := read[id]; !ok {
297 read[id] = 0
298 }
299 }
300 return
301}
302
303//删除单条阅读记录
304func (this *ReadRecord) Delete(uid, docId int) (err error) {

Callers 1

BookInfoMethod · 0.80

Calls 1

AllMethod · 0.45

Tested by

no test coverage detected