thirdPartyContent.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // 第三方内容管理API
  2. const api = require('../utils/api');
  3. // 分页获取第三方自己的书籍列表
  4. function getMyContentPage(current = 1, size = 10, keyword = '') {
  5. const params = { current, size };
  6. if (keyword && keyword.trim()) {
  7. params.keyword = keyword;
  8. }
  9. return api.get('/app/third-party/content/page', params);
  10. }
  11. // 获取书籍详情
  12. function getContentDetail(contentId) {
  13. return api.get(`/app/third-party/content/${contentId}`);
  14. }
  15. // 上传书籍
  16. function uploadContent(contentData) {
  17. return api.post('/app/third-party/content', contentData);
  18. }
  19. // 编辑书籍
  20. function updateContent(contentId, contentData) {
  21. return api.put(`/app/third-party/content/${contentId}`, contentData);
  22. }
  23. // 下架书籍
  24. function offlineContent(contentId) {
  25. return api.post(`/app/third-party/content/${contentId}/offline`, {});
  26. }
  27. // 上架书籍
  28. function onlineContent(contentId) {
  29. return api.post(`/app/third-party/content/${contentId}/online`, {});
  30. }
  31. // 申请删除书籍
  32. function requestDeleteContent(contentId) {
  33. return api.post(`/app/third-party/content/${contentId}/delete-request`, {});
  34. }
  35. // 获取审核状态统计
  36. function getStatistics() {
  37. return api.get('/app/third-party/content/statistics');
  38. }
  39. module.exports = {
  40. getMyContentPage,
  41. getContentDetail,
  42. uploadContent,
  43. updateContent,
  44. offlineContent,
  45. onlineContent,
  46. requestDeleteContent,
  47. getStatistics
  48. };