import request from "../utils/request";

export function queryVideoDetail(data) {
  return request({
    url: "/app/video/live/info/get",
    method: "POST",
    data,
  });
}

// 获取播放签名
export const getPlaySign = (data) =>
  request({
    url: "/app/video/playerSign",
    method: "POST",
    data,
  });

// APP获取播放信息
export function queryPlayInfo(queryParams) {
  return request({
    url: "/app/video/live/playInfo",
    method: "get",
    params: queryParams,
  });
}

// APP查询WebSocket配置
export function queryWebSocketConf(queryParams) {
  return request({
    url: "/app/common/getWebSocketConf",
    method: "get",
    params: queryParams,
  });
}

// APP发送直播互动消息
export function liveMsgSend(queryParams) {
  return request({
    url: "/app/video/live/message/send",
    method: "post",
    data: queryParams,
  });
}

// APP获取关注投顾的视频直播列表(包含正在直播的关注的投顾+首页推荐的正在直播的投顾)
export function queryTgLiveList(queryParams) {
  return request({
    url: "/app/advisor-video/info/listFollow",
    method: "get",
    params: queryParams,
  });
}

// APP查询当前直播购物车
export function queryCartList(queryParams) {
  return request({
    url: "/app/video/live/cartList",
    method: "get",
    params: queryParams,
  });
}

// APP发送关注投顾消息(消息推送)
export function sendFollowMessage(queryParams) {
  return request({
    url: "/app/video/live/message/followMessage",
    method: "post",
    data: queryParams,
  });
}

// APP用户点赞视频
export function likeVideo(queryParams) {
  return request({
    url: "/app/video/live/info/favor",
    method: "post",
    data: queryParams,
  });
}

// APP用户分享直播（消息推送）
export function sendLiveShare(id, saleUserId) {
  return request({
    url: `/app/video/live/info/share?id=${id}&saleUserId=${saleUserId}`,
    method: "post",
  });
}

// APP用户观看视频（消息推送）
export function sendLiveLook(queryParams) {
  return request({
    url: `/app/video/live/info/read`,
    method: "post",
    data: queryParams,
  });
}

// APP用户预约直播
export function subLiveVideo(queryParams) {
  return request({
    url: `/app/video/live/info/subscribe`,
    method: "post",
    data: queryParams,
  });
}

// 前端-用户领券
export function receiveCoupon(queryParams) {
  return request({
    url: "/frontend/couponserver/logic/claim",
    method: "post",
    data: queryParams,
  });
}

// 记录播放进度
export const recordPlayProgress = (data) =>
  request({
    url: "/app/video/live/saveReadRecord",
    method: "POST",
    data,
  });

// 购物车产品点击统计
export function queryCartRead(queryParams) {
  return request({
    url: `/app/video/live/cart/read`,
    method: "post",
    data: queryParams,
  });
}

//客户信息收集
export function liveCustomerSave(queryParams) {
  return request({
    url: `/app/video/live/customer/save`,
    method: "post",
    data: queryParams,
  });
}

// APP直播观看限制
export function queryLiveLimit(queryParams) {
  return request({
    url: "/app/video/live/limit",
    method: "post",
    data: queryParams,
  });
}

// 获取视频活动
export function queryActivity(queryParams) {
  return request({
    url: "/app/video/live/notify/activity",
    method: "get",
    params: queryParams,
  });
}

// 获取直播历史互动消息
export function queryLiveHisMsg(queryParams) {
  return request({
    url: `/app/video/live/message/list`,
    method: "post",
    data: queryParams,
  });
}

// 获取直播讲师历史消息
export function queryLiveTgHisMsg(queryParams) {
  return request({
    url: `/app/video/live/advisorMessage/list`,
    method: "post",
    data: queryParams,
  });
}

// 查询直播最新的优惠券
export function queryLiveCoupon(queryParams) {
  return request({
    url: `/backend/couponserver/sendcoupon/listByLive`,
    method: "post",
    data: queryParams,
  });
}

// 浏览记录
export function sendBrowseInfo(queryParams) {
  return request({
    url: "/app/video/live/info/browse",
    method: "get",
    params: queryParams,
  });
}

// 用户答题
export function questionAnswer(queryParams) {
  return request({
    url: `/app/video/live/question/answer`,
    method: "post",
    data: queryParams,
  });
}

// app问卷详情
export function queryQuestionDetail(queryParams) {
  return request({
    url: "/app/video/live/question/details",
    method: "get",
    params: queryParams,
  });
}

// 是否填写过问卷 ture已填写 false 未填写
export function queryQuestionCheck(queryParams) {
  return request({
    url: "/app/video/live/question/check",
    method: "get",
    params: queryParams,
  });
}

//用户的我的优惠券
export function queryMyCoupon() {
  return request({
    url: "/frontend/couponserver/logic/myCoupon",
    method: "post",
  });
}

// APP查询视频详情扩展信息
export function queryVideoExt(data) {
  return request({
    url: "/app/video/live/info/getExt",
    method: "post",
    data,
  });
}

// app端查询企微详情
export function queryWeiXinCode(data) {
  return request({
    url: "/app/work-weixin/info/get",
    method: "post",
    data,
  });
}

// app查询即将开播的直播
export function queryNotPlay(queryParams) {
  return request({
    url: "/app/video/notPlay",
    method: "get",
    params: queryParams,
  });
}

// APP查询最近推送的产品
export function getNewCarPush(queryParams) {
  return request({
    url: "/app/video/live/recent",
    method: "get",
    params: queryParams,
  });
}
