live.js 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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: (sotreId) => `/app/live/liveData/collectStore?storeId=${sotreId}`,
  8. // 店铺收藏/取消收藏
  9. collectGoods: (goodId) => `/app/live/liveData/collectGoods?goodId=${goodId}`,
  10. // 商品收藏/取消收藏
  11. store: (storeld, key) => `/app/live/store/${storeld}?key=${key}`,
  12. // 小黄车查询店铺
  13. queryStore: (storeld, pageSize, pageNum, keywords) => `/app/live/store?storeId=${storeld}&pageSize=${pageSize}&pageNum=${pageNum}&keywords=${keywords}`,
  14. // 查询店铺
  15. follow: (liveId) => `/app/live/liveData/follow/${liveId}`,
  16. // 关注/取消关注
  17. // getRecentLiveViewers: (liveId) => `/app/live/liveData/getRecentLiveViewers/${liveId}`, // 获取直播间用户(展示在线用户)
  18. watchUserList: (liveId, pageSize, pageNum, reasonable) => `/app/live/liveWatchUser/watchUserList/?liveId=${liveId}&pageSize=${pageSize}&pageNum=${pageNum}&reasonable=${reasonable}`,
  19. // 获取直播间用户(展示在线用户)
  20. liveMsg: (liveId, pageSize, pageNum) => `/app/live/liveMsg/list/?liveId=${liveId}&pageSize=${pageSize}&pageNum=${pageNum}`,
  21. //获取最近聊天记录
  22. // checkSms: 'api/sms/checkSms',
  23. getLiveInfo: (liveId) => `/app/live/${liveId}`,
  24. // 获取直播间信息接口
  25. getLiveViewData: (liveId) => `/app/live/liveData/getLiveViewData/${liveId}`,
  26. // 直播间点赞、关注、在线人数数据
  27. liveRed: "/app/live/liveRed/claim",
  28. // 点击领红包
  29. // 直播订单
  30. liveStore: (liveId, key) => `/app/live/liveGoods/liveStore/${liveId}?key=${key}`,
  31. // 店铺展示
  32. liveGoodsDetail: (productId) => `/app/live/liveGoods/liveGoodsDetail/${productId}`,
  33. // 商品详情
  34. liveOrderUser: (liveId) => `/app/live/liveOrder/liveOrderUser/${liveId}`
  35. // 正在购买
  36. };
  37. function liveDataLike(liveId, data = {}) {
  38. return request(api.liveDataLike(liveId), data, "GET", "application/json;charset=UTF-8");
  39. }
  40. function collectStore(sotreId, data = {}) {
  41. return request(api.collectStore(sotreId), data, "POST", "application/json;charset=UTF-8");
  42. }
  43. function collectGoods(goodId, data = {}) {
  44. return request(api.collectGoods(goodId), data, "POST", "application/json;charset=UTF-8");
  45. }
  46. function store(storeld, key, data = {}) {
  47. return request(api.store(storeld, key), data, "GET", "application/json;charset=UTF-8");
  48. }
  49. function queryStore(storeld, pageSize, pageNum, keywords, data = {}) {
  50. return request(api.queryStore(storeld, pageSize, pageNum, keywords), data, "GET", "application/json;charset=UTF-8");
  51. }
  52. function liveRed(data) {
  53. return request(api.liveRed, data, "POST", "application/json;charset=UTF-8");
  54. }
  55. function follow(liveId, data = {}) {
  56. return request(api.follow(liveId), data, "GET", "application/json;charset=UTF-8");
  57. }
  58. function watchUserList(liveId, pageSize, pageNum, reasonable, data = {}) {
  59. return request(api.watchUserList(liveId, pageSize, pageNum, reasonable), data, "GET", "application/json;charset=UTF-8");
  60. }
  61. function liveMsg(liveId, pageSize, pageNum, data = {}) {
  62. return request(api.liveMsg(liveId, pageSize, pageNum), data, "GET", "application/json;charset=UTF-8");
  63. }
  64. function liveGoodsDetail(productId, data) {
  65. return request(api.liveGoodsDetail(productId), data, "GET", "application/json;charset=UTF-8");
  66. }
  67. function liveOrderUser(liveId, data = {}) {
  68. return request(api.liveOrderUser(liveId), data, "GET", "application/json;charset=UTF-8");
  69. }
  70. function getLiveInfo(liveId, data = {}) {
  71. return request(api.getLiveInfo(liveId), data, "GET", "application/json;charset=UTF-8");
  72. }
  73. function getLiveViewData(liveId, data = {}) {
  74. return request(api.getLiveViewData(liveId), data, "GET", "application/json;charset=UTF-8");
  75. }
  76. exports.collectGoods = collectGoods;
  77. exports.collectStore = collectStore;
  78. exports.follow = follow;
  79. exports.getLiveInfo = getLiveInfo;
  80. exports.getLiveViewData = getLiveViewData;
  81. exports.liveDataLike = liveDataLike;
  82. exports.liveGoodsDetail = liveGoodsDetail;
  83. exports.liveMsg = liveMsg;
  84. exports.liveOrderUser = liveOrderUser;
  85. exports.liveRed = liveRed;
  86. exports.queryStore = queryStore;
  87. exports.store = store;
  88. exports.watchUserList = watchUserList;