Files
uniapp-im-shop/api/tui-kit.js

193 lines
3.7 KiB
JavaScript

import http from '@/utils/request'
/**
* 创建/修改群组
* @param {*} data
* @param {*} method post 创建 put 修改
* @returns
*/
export const createImGroup = (data, method = 'post') => {
return http({
url: '/api/service/imGroup',
method,
data
})
}
/** 删除群 */
export const deleteImGroup = groupId => {
return http({
url: `/api/service/imGroup/remove`,
method: 'post',
data: { groupId }
})
}
/** 群成员退出群 */
export const quitImGroup = groupId => {
return http({
url: `/api/service/imGroupMember/leave`,
method: 'post',
data: { groupId }
})
}
/** 删除群组成员 */
export const deleteImGroupMember = (groupId, memberId) => {
return http({
url: `/api/service/imGroup/removeMember`,
method: 'post',
data: { groupId, memberId }
})
}
/** 发红包 */
export const sendRedEnvelope = data => {
return http({
url: '/api/system/pointsRedPacket/send',
method: 'post',
data
})
}
/** 领取红包 */
export const receiveRedEnvelope = data => {
return http({
url: `/api/system/pointsRedPacket/receive`,
method: 'post',
data
})
}
/**
* 获取红包详情
* status 1:进行中,2:已领完,3:已过期,4:已撤销
* receivedCount 已领取红包个数
* receivedAmount 已领取红包金额
* hasReceived 当前用户是否已领取
* receiveList 领取列表
* luckyReceive 手气最佳
*/
export const getRedEnvelopeDetail = id => {
return http({
url: `/api/system/pointsRedPacket/${id}`,
method: 'get'
})
}
/**
* 新增/修改主播
* @param {*} data
* @param {*} method post 新增 put 修改
* @returns
*/
export const addAnchor = (data, method = 'post') => {
return http({
url: '/api/service/liveAnchor',
method,
data
})
}
/** 主播详情 */
export const getAnchorDetail = () => {
return http({
url: `/api/service/liveAnchor/details`,
method: 'get'
})
}
/** 添加修改直播 */
export const imAddLive = (data, method = 'post') => {
return http({
url: '/api/service/imLiveRoom',
method,
data
})
}
/** 开始直播 */
export const imDataStartLive = roomId => {
return http({
url: `/api/service/imLiveRoom/start/${roomId}`,
method: 'post',
/** 错误是否返回上一页 */
isErrorBack: true
})
}
/** 结束直播 */
export const imDataEndLive = (roomId, viewers) => {
return http({
url: `/api/service/imLiveRoom/${roomId}/${viewers}`,
method: 'delete'
})
}
/** 新增直播间活动 */
export const addLiveActivity = (data, method = 'post') => {
return http({
url: '/api/service/imLiveActivity',
method,
data
})
}
/** 获取直播间活动详情 */
export const getLiveActivityDetail = id => {
return http({
url: `/api/service/imLiveActivity/${id}`,
method: 'get'
})
}
/** 确认参加活动 */
export const confirmLiveActivity = data => {
return http({
url: `/api/service/imLiveActivityRecord`,
method: 'post',
data
})
}
/** 查询活动参与状态 */
export const getLiveActivityRecord = id => {
return http({
url: `/api/service/imLiveActivityRecord/partic/ipated/${id}`,
method: 'get'
})
}
/** 直播记录列表 */
export const getLiveRecordList = data => {
return http({
url: `/api/service/imLiveRoom/list`,
method: 'get',
data
})
}
/** 直播记录详情 */
export const getLiveRecordDetail = id => {
return http({
url: `/api/service/imLiveRoom/${id}`,
method: 'get'
})
}
/** 生成直播ID */
export const getLiveId = () => {
return http({
url: `/api/service/imLiveRoom/roomId`,
method: 'get'
})
}
/** 直播间列表 */
export const getLiveRoomList = data => {
return http({
url: `/api/service/imLiveRoom/list/all`,
method: 'get',
data
})
}