import Request from '@/common/request.js';
let request = new Request().http
const api = {
	liveDataLike: (liveId) => `/app/live/liveData/like/${liveId}`, // 点赞
	collectStore: (sotreId) => `/app/live/liveData/collectStore?storeId=${sotreId}`, // 店铺收藏/取消收藏
	collectGoods: (goodId) => `/app/live/liveData/collectGoods?goodId=${goodId}`, // 商品收藏/取消收藏
	store: (storeld, key, liveId) => `/app/live/store/${storeld}?key=${key}&liveId=${liveId}`, // 小黄车查询店铺

	queryStore: (storeld, pageSize, pageNum, keywords) =>
		`/app/live/store?storeId=${storeld}&pageSize=${pageSize}&pageNum=${pageNum}&keywords=${keywords}`, // 查询店铺
	follow: (liveId) => `/app/live/liveData/follow/${liveId}`, // 关注/取消关注
	// getRecentLiveViewers: (liveId) => `/app/live/liveData/getRecentLiveViewers/${liveId}`, // 获取直播间用户(展示在线用户)
	watchUserList: (liveId, pageSize, pageNum, reasonable) =>
		`/app/live/liveWatchUser/watchUserList/?liveId=${liveId}&pageSize=${pageSize}&pageNum=${pageNum}&reasonable=${reasonable}`, // 获取直播间用户(展示在线用户)
	liveMsg: (liveId, pageSize, pageNum) =>
		`/app/live/liveMsg/list/?liveId=${liveId}&pageSize=${pageSize}&pageNum=${pageNum}`, //获取最近聊天记录

	// checkSms: 'api/sms/checkSms',
	getLiveInfo: (liveId) => `/app/live/${liveId}`, // 获取直播间信息接口
	getLiveViewData: (liveId) => `/app/live/liveData/getLiveViewData/${liveId}`, // 直播间点赞、关注、在线人数数据
	liveRed: '/app/live/liveRed/claim', // 点击领红包
	// 直播订单
	liveStore: (liveId, key) => `/app/live/liveGoods/liveStore/${liveId}?key=${key}`, // 店铺展示
	
	
	liveGoodsDetail: (productId) => `/app/live/liveGoods/liveGoodsDetail/${productId}`, // 商品详情
	liveOrderUser: (liveId) => `/app/live/liveOrder/liveOrderUser/${liveId}`, // 正在购买
	showGoods: (liveId) => `/app/live/liveGoods/showGoods/${liveId}`, // 弹出商品卡片
	currentActivities: (liveId) => `/liveAPP/app/live/currentActivities?liveId=${liveId}`, // 弹出商品卡片
	claim: '/app/live/liveLottery/claim', // 抽奖
	liveLottery: '/app/live/liveLottery/detail', // 抽奖查询
	getlive: '/app/live/live',
	liveList: '/app/live/liveList', //直播列表
	liveShareList: (companyId, pageSize, pageNum) =>
		`/app/live/liveList/${companyId}?pageSize=${pageSize}&pageNum=${pageNum}`, //销售端分享直播列表
	subNotifyLive: '/app/live/subNotifyLive' ,//订阅消息
	coupon: '/app/live/coupon/claim' ,//领取优惠券
	curCoupon: '/app/live/coupon/curCoupon' ,//优惠券列表
}
// 点赞
export function liveDataLike(liveId, data = {}) {
	return request(api.liveDataLike(liveId), data, 'GET', 'application/json;charset=UTF-8')
}

// 店铺收藏/取消收藏
export function collectStore(sotreId, data = {}) {
	return request(api.collectStore(sotreId), data, 'POST', 'application/json;charset=UTF-8')
}

// 商品收藏/取消收藏
export function collectGoods(goodId, data = {}) {
	return request(api.collectGoods(goodId), data, 'POST', 'application/json;charset=UTF-8')
}
// 小黄车查询店铺
export function store(storeld, key, liveId, data = {}) {
	return request(api.store(storeld, key, liveId), data, 'GET', 'application/json;charset=UTF-8')
}
// 查询店铺
export function queryStore(storeld, pageSize, pageNum, keywords, data = {}) {
	return request(api.queryStore(storeld, pageSize, pageNum, keywords), data, 'GET', 'application/json;charset=UTF-8',
		false)
}

//弹出商品卡片
export function showGoods(liveId, data = {}) {
	return request(api.showGoods(liveId), data, 'GET', 'application/json;charset=UTF-8')
}

// 点击领红包
export function liveRed(data) {
	return request(api.liveRed, data, 'POST', 'application/json;charset=UTF-8')
}

// 关注/取消关注
export function follow(liveId, data = {}) {
	return request(api.follow(liveId), data, 'GET', 'application/json;charset=UTF-8')
}


// 观众
// 获取直播间用户(展示在线用户)
// export function getRecentLiveViewers(liveId, data = {}) {
// 	return request(api.getRecentLiveViewers(liveId), data, 'GET', 'application/json;charset=UTF-8')
// }
// 获取直播间用户(展示在线用户)
export function watchUserList(liveId, pageSize, pageNum, reasonable, data = {}) {
	return request(api.watchUserList(liveId, pageSize, pageNum, reasonable), data, 'GET',
		'application/json;charset=UTF-8')
}
// 获取最近聊天记录
export function liveMsg(liveId, pageSize, pageNum, data = {}) {
	return request(api.liveMsg(liveId, pageSize, pageNum), data, 'GET', 'application/json;charset=UTF-8')
}
// 加载直播间消息接口
// export function liveMsg(liveId, pageSize, pageNum, data = {}) {
// 	return request('/app/live/liveMsg/myList', data, 'GET', 'application/json;charset=UTF-8');
// }


// 小黄车
// 店铺展示
export function liveStore(liveId, key, data) {
	return request(api.liveStore(liveId, key), data, 'GET', 'application/json;charset=UTF-8')
}

// 商品详情
export function liveGoodsDetail(productId, data) {
	return request(api.liveGoodsDetail(productId), data, 'GET', 'application/json;charset=UTF-8')
}

//正在购买
export function liveOrderUser(liveId, data = {}) {
	return request(api.liveOrderUser(liveId), data, 'GET', 'application/json;charset=UTF-8')
}






// 直播间
export function getLiveInfo(liveId, data = {}) {
	return request(api.getLiveInfo(liveId), data, 'GET', 'application/json;charset=UTF-8')
}

// 直播间点赞、关注、在线人数数据
export function getLiveViewData(liveId, data = {}) {
	return request(api.getLiveViewData(liveId), data, 'GET', 'application/json;charset=UTF-8')
}


// 红包 卡片 抽奖
export function currentActivities(liveId, data = {}) {
	return request(api.currentActivities(liveId), data, 'GET', 'application/json;charset=UTF-8')
}

//抽奖
export function claim(data) {
	return request(api.claim, data, 'POST', 'application/json;charset=UTF-8')
}
// 抽奖查询
export function liveLottery(data) {
	return request(api.liveLottery, data, 'POST', 'application/json;charset=UTF-8')
}

//直播间信息
export function getlive(data) {
	return request(api.getlive, data, 'GET', 'application/json;charset=UTF-8');
}
//直播列表
export function liveList(data) {
	return request(api.liveList, data, 'GET', 'application/json;charset=UTF-8');
}

//销售端分享直播列表
export function liveShareList(companyId, pageSize, pageNum, data = {}) {
	return request(api.liveShareList(companyId, pageSize, pageNum), data, 'GET', 'application/json;charset=UTF-8');
}

//订阅消息
export function subNotifyLive(data) {
	return request(api.subNotifyLive, data, 'POST', 'application/json;charset=UTF-8');
}

//领取优惠券
export function coupon(data) {
	return request(api.coupon, data, 'POST', 'application/json;charset=UTF-8');
}

//优惠券列表
export function curCoupon(data) {
	return request(api.curCoupon, data, 'POST', 'application/json;charset=UTF-8');
}

// 流量(缓冲百分比)
export function internetTraffic(data) {
	return request('/app/live/liveTrafficLog/getInternetTraffic', data, 'POST', 'application/json;charset=UTF-8');
}
// 直播流量(缓冲百分比)
export function liveInternetTraffic(data) {
	return request('/app/live/liveTrafficLog/getLiveInternetTraffic', data, 'POST', 'application/json;charset=UTF-8');
}

// 芳华币
export function getUserIntegralInfo(data) {
	return request('/liveAPP/app/live/liveData/getUserIntegralInfo', data, 'GET', 'application/json;charset=UTF-8');
}

// 我的中奖明细
export function myLottery(data) {
	return request('/app/live/liveLottery/myLottery', data, 'GET', 'application/json;charset=UTF-8');
}
// // 消息弹窗
// export function sendPopMsg(liveId, pageSize, pageNum, data = {}) {
// 	return request('/app/live/liveMsg/myList', data, 'GET', 'application/json;charset=UTF-8');
// }


// 查询正常状态的礼物列表，按价格升序排列
export function activeList(data) {
	return request('/app/live/liveGift/activeList', data, 'GET', 'application/json;charset=UTF-8');
}
// 用户送礼物
export function sendliveGift(data) {
	return request('/app/live/liveGift/send', data, 'POST', 'application/json;charset=UTF-8');
}


 // 查询当前用户当前直播间领取积分的剩余时长 (传入直播间id)
 export function remainingTime(data) {
  	return request('/app/live/completion/remaining-time',data,'GET','application/json;charset=UTF-8');
 }
 // 更新用户的看课时长 (传入直播间id和看课时长)
 export function updateWatchDuration(liveId,watchDuration) {
  	return request(`/app/live/completion/update-watch-duration?liveId=${liveId}&watchDuration=${watchDuration}`,null,'POST','application/json;charset=UTF-8');
 }
 // 用户领取看课积分(传入直播间id)
 export function receivePoints(data) {
  	return request(`/app/live/completion/receive-points?liveId=${data}`,data,'POST','application/json;charset=UTF-8');
 }
 // 查询用户自己的积分记录
 export function integrallogs(data) {
  	return request('/app/live/completion/integral-logs',data,'GET','application/json;charset=UTF-8');
 }
// 静默登录
// export function loginByMp(data) {
// 	return request('/liveAPP/app/wx/login', data, 'POST', 'application/json;charset=UTF-8');
// }
export function loginByMp(data) {
	return request('/liveAPP/app/wx/loginByMiniApp', data, 'POST', 'application/json;charset=UTF-8');
}
export function getUserInfo() {
	return request('/liveAPP/app/user/getUserInfo', null, 'GET');
}
