mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-08-06 02:47:25 +08:00
直播功能
This commit is contained in:
75
api/live.js
Normal file
75
api/live.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* 直播流相关 API
|
||||
*/
|
||||
import { http, Method } from "@/utils/request.js";
|
||||
|
||||
/**
|
||||
* 通过 id 获取直播间详情
|
||||
* @param {string} id 直播流 ID
|
||||
*/
|
||||
export function getLiveRoomById(id) {
|
||||
return http.request({
|
||||
url: `live/room/${id}`,
|
||||
method: Method.GET,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 观看的同时注册直播用户
|
||||
* @param {string} liveRoomId 直播流 ID
|
||||
*/
|
||||
export function registerLiveViewUser(liveRoomId) {
|
||||
return http.request({
|
||||
url: `live/user/view`,
|
||||
method: Method.POST,
|
||||
params: { liveRoomId },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送直播消息
|
||||
* @param {object} data LiveMessage
|
||||
*/
|
||||
export function sendLiveMessage(data) {
|
||||
return http.request({
|
||||
url: `live/message`,
|
||||
method: Method.POST,
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播轮询聚合数据
|
||||
* @param {string} id 直播流 ID
|
||||
*/
|
||||
export function getLivePollingData(id) {
|
||||
return http.request({
|
||||
url: `live/room/polling/${id}`,
|
||||
method: Method.GET,
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取直播间优惠券
|
||||
* @param {string} liveRoomId 直播流 ID
|
||||
* @param {string} couponId 优惠券 ID
|
||||
*/
|
||||
export function receiveLiveCoupon(liveRoomId, couponId) {
|
||||
return http.request({
|
||||
url: `promotion/coupon/receive/live/${liveRoomId}/${couponId}`,
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播系统配置(LIVE_SETTING,含 imSdkAppid)
|
||||
*/
|
||||
export function getLiveSetting() {
|
||||
return http.request({
|
||||
url: "system/setting/get/LIVE_SETTING",
|
||||
method: Method.GET,
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
@@ -17,6 +17,23 @@ export function getLiveList(params) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播间详情
|
||||
* @deprecated 请使用 api/live.js 中的 getLiveRoomById
|
||||
* @param {number} roomId 直播间房间号
|
||||
*/
|
||||
export function getLiveDetail(roomId) {
|
||||
return http.request({
|
||||
url: `broadcast/studio`,
|
||||
method: Method.GET,
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 1,
|
||||
roomId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前拼团活动的未成团的会员
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user