查询阅读进度
(uid int, bookId ...int)
| 285 | |
| 286 | // 查询阅读进度 |
| 287 | func (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 | //删除单条阅读记录 |
| 304 | func (this *ReadRecord) Delete(uid, docId int) (err error) { |