bookshelf.js 699 B

12345678910111213141516171819202122232425262728293031323334
  1. // 书架相关API
  2. const api = require('../utils/api');
  3. // 获取书架列表
  4. function getBookshelfList(userId) {
  5. return api.get('/user/bookshelf/list', { userId });
  6. }
  7. // 加入书架
  8. function addToBookshelf(userId, contentId) {
  9. return api.post('/user/bookshelf/add', {}, false, { userId, contentId });
  10. }
  11. // 移出书架
  12. function removeFromBookshelf(userId, contentId) {
  13. return api.del('/user/bookshelf/remove', { userId, contentId });
  14. }
  15. // 检查是否在书架中
  16. function checkInBookshelf(userId, contentId) {
  17. return api.get('/user/bookshelf/check', { userId, contentId });
  18. }
  19. module.exports = {
  20. getBookshelfList,
  21. addToBookshelf,
  22. removeFromBookshelf,
  23. checkInBookshelf
  24. };