/* 短视频API */
import api from "@/api/http.js";
var host = process.env.VUE_APP_Host; // 获取不同环境下不同的api路径
var java_host = process.env.VUE_APP_Url; //JAVAapi路径

//根据医生id获取医生信息
export const getDoctorById = (data) => {
  return api.get(java_host + `/ymall/doctor/getById?id=${data}`)
}

//二级科室列表
export const getDepartmentListByEr = (data) => {
  return api.post(java_host + '/ymall/department/query', data)
}

//上传封面
export const getvideoCover = (params, config) => {
  return api.post(java_host + '/ymall/file/upload/videoCover', params, config)
}

//刷新视频上传凭证
export const refreshUploadVideo = (data) => {
  return api.post(java_host + `/ymall/videoDoctor/RefreshUploadVideo?videoid=${data}`)
}

//医生获取上传视频凭证
export const getUploadByAliClound = (data) => {
  return api.post(java_host + `/ymall/videoDoctor/CreateUploadVideo?title=${data}`)
}

// 获取用户关注医生列表
export const getMyFollowList = (data) => {
  return api.post(java_host + '/ymall/videoUser/GetMyFollowList', data)
}


// 获取用户喜欢的视频列表
export const getMyLikeList = (data) => {
  return api.post(java_host + '/ymall/videoUser/GetMyLikeList', data)
}

// 关注医生
export const addFollow = (data) => {
  return api.post(java_host + '/ymall/videoUser/AddFollow', data)
}

// 取消关注医生
export const cancelFollow = (data) => {
  return api.post(java_host + '/ymall/videoUser/CancelFollow', data)
}

// 获取视频列表
export const searchVideoList = (data) => {
  return api.post(java_host + '/ymall/videoUser/SerachVideoList', data)
}

// 获取首页视频列表
export const searchVideoListByHome = (data) => {
  return api.post(java_host + '/ymall/videoUser/GetVideoListByHome', data)
}


// 视频点赞
export const addLike = (data) => {
  return api.post(java_host + '/ymall/videoUser/AddLike', data)
}

// 视频取消点赞
export const cancelLike = (data) => {
  return api.post(java_host + '/ymall/videoUser/CancelLike', data)
}


// 视频播放次数新增
export const addPlay = (data) => {
  return api.post(java_host + '/ymall/videoUser/AddPlay', data)
}


// 视频分享次数新增
export const addShare = (data) => {
  return api.post(java_host + '/ymall/videoUser/AddShare', data)
}

// 新增评论
export const addComment = (data) => {
  return api.post(java_host + '/ymall/videoUser/AddComment', data)
}


// 获取评论
export const getCommentList = (data) => {
  return api.post(java_host + '/ymall/videoUser/GetVideoCommentDTOList', data)
}


// 根据指定的ID获取视频
/**
 * 
 * @param {string} ID - 视频的ID值 
 */
export const getVideoById = (data) => {
  return api.post(java_host + '/ymall/videoUser/GetVideo', {
    ...data
  })
}

// 获取医生主页短视频API
export const getDoctorShortVideo = (data) => {
  return api.post(java_host + '/ymall/videoUser/GetVideoList', data)
}


// 搜索视频API
export const searchVideo = (data) => {
  return api.post(java_host + '/ymall/videoUser/SerachVideoList', data)
}

// 搜索医生API
export const searchDoctor = (data) => {
  return api.post(host + '/api/Program/SearchDoctorList', data)
}

// 获取医生详细信息
export const getDoctorInfo = (data) => {
  // return api.post(host+'/api/Program/GetDoctorDiss', data)
  return api.get(java_host + '/ymall/doctor/getInfo', data)
}


// 获取医生自己上传的视频
export const getDoctorProduction = (data) => {
  return api.post(java_host + '/ymall/videoDoctor/GetMyVideoList', data)
}

// 医生上传视频
export const uploadFile = (params, config) => {
  // return api.post(host+'/api/Home/UploadFile?isCompress=true', params,config)
  return api.post(host + '/api/Home/UploadFile', params, config)
}

// 获取视频上传地址和凭证
export const createUploadVideo = (title) => {
  return api.post(java_host + `/ymall/videoDoctor/CreateUploadVideo?Title=${title}`, )
}


// 上传视频归属到医生
export const uploadFileByDoctor = (data) => {
  return api.post(java_host + '/ymall/videoDoctor/UploadFileByDoctor', data)
}


// 获取用户基本信息
export const getUserInfo = (data) => {
  // return api.post(host + '/api/Account/GetUserInfo', data)
  return api.post(java_host + '/ymall/user/GetUserInfo', data)
}


// 获取医生上传的视频列表中正在转码的视频
export const GetMyVideoListByTranscoding = (data) => {
  return api.post(java_host + '/ymall/videoDoctor/GetMyVideoListByTranscoding', data)
}

// 获取首页推荐短视频列表
export const getVideoByHomePage = (data) => {
  return api.post(java_host + '/ymall/videoUser/GetVideoListByHomePage', data);
}


// 获取搜索视频的二级科室
export const getSecondDepartmentList = (data) => {
  return api.post(host + '/api/Home/GetDepartmentListByEr', data);
}