live.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. "use strict";
  2. const common_request = require("../common/request.js");
  3. let request = new common_request.Request().http;
  4. const api = {
  5. liveDataLike: (liveId) => `/app/live/liveData/like/${liveId}`,
  6. // 点赞
  7. collectStore: "/app/live/liveData/collectStore",
  8. // 收藏/取消收藏
  9. follow: (liveId) => `/app/live/liveData/follow/${liveId}`,
  10. // 关注/取消关注
  11. getRecentLiveViewers: (liveId) => `/app/live/liveData/getRecentLiveViewers/${liveId}`,
  12. // 获取直播间用户(展示在线用户)
  13. // checkSms: 'api/sms/checkSms',
  14. getLiveInfo: (liveId) => `/app/live/${liveId}`,
  15. // 获取直播间信息接口
  16. getLiveViewData: (liveId) => `/app/live/liveData/getLiveViewData/${liveId}`,
  17. // 直播间点赞、关注、在线人数数据
  18. // 直播订单
  19. liveStore: (liveId) => `/app/live/liveGoods/liveStore/${liveId}`,
  20. // 店铺展示
  21. liveGoodsDetail: (productId) => `/app/live/liveGoods/liveGoodsDetail/${productId}`,
  22. // 商品详情
  23. liveOrderUser: (liveId) => `/app/live/liveOrder/liveOrderUser/${liveId}`
  24. // 正在购买
  25. };
  26. function liveDataLike(liveId, data = {}) {
  27. return request(api.liveDataLike(liveId), data, "GET", "application/json;charset=UTF-8");
  28. }
  29. function collectStore(data) {
  30. return request(api.collectStore, data, "GET", "application/json;charset=UTF-8");
  31. }
  32. function follow(liveId, data = {}) {
  33. return request(api.follow(liveId), data, "GET", "application/json;charset=UTF-8");
  34. }
  35. function getRecentLiveViewers(liveId, data = {}) {
  36. return request(api.getRecentLiveViewers(liveId), data, "GET", "application/json;charset=UTF-8");
  37. }
  38. function liveStore(liveId, data) {
  39. return request(api.liveStore(liveId), data, "GET", "application/json;charset=UTF-8");
  40. }
  41. function liveGoodsDetail(productId, data) {
  42. return request(api.liveGoodsDetail(productId), data, "GET", "application/json;charset=UTF-8");
  43. }
  44. function liveOrderUser(liveId, data = {}) {
  45. return request(api.liveOrderUser(liveId), data, "GET", "application/json;charset=UTF-8");
  46. }
  47. function getLiveInfo(liveId, data = {}) {
  48. return request(api.getLiveInfo(liveId), data, "GET", "application/json;charset=UTF-8");
  49. }
  50. function getLiveViewData(liveId, data = {}) {
  51. return request(api.getLiveViewData(liveId), data, "GET", "application/json;charset=UTF-8");
  52. }
  53. exports.collectStore = collectStore;
  54. exports.follow = follow;
  55. exports.getLiveInfo = getLiveInfo;
  56. exports.getLiveViewData = getLiveViewData;
  57. exports.getRecentLiveViewers = getRecentLiveViewers;
  58. exports.liveDataLike = liveDataLike;
  59. exports.liveGoodsDetail = liveGoodsDetail;
  60. exports.liveOrderUser = liveOrderUser;
  61. exports.liveStore = liveStore;