import request from '@/utils/request'


export function getVideoList(query) {
  return request({
    url: '/vod/video/',
    method: 'get',
    params: query
  })
}

export function getsignature() {
  return request({
    url: '/vod/signature/',
    method: 'get'
  })
}
export function createVideo(data) {
  return request({
    url: '/vod/video/',
    method: 'post',
    data
  })
}
export function deletevideo(id, data) {
  return request({
    url: `/vod/video/${id}/`,
    method: 'delete',
    data
  })
}
export function updatevideo(id, data) {
  return request({
    url: `/vod/video/${id}/`,
    method: 'put',
    data
  })
}
export function getVideo(id) {
  return request({
    url: `/vod/video/${id}/`,
    method: 'get'
  })
}

export function getVideoPlayCode(id) {
  return request({
    url: `/vod/playcode/${id}/`,
    method: 'get'
  })
}
//已弃用
export function getMyView(id, data) {
  return request({
    url: `/vod/video/${id}/myview/`,
    method: 'get',
    data
  })
}
//已弃用
export function refreshMyView(id, data) {
  return request({
    url: `/vod/video/${id}/myview/`,
    method: 'put',
    data
  })
}

//开始播放
export function videoStart(id) {
  return request({
    url: `/vod/video/${id}/start/`,
    method: 'get'
  })
}
//观看统计
export function videoView2(data) {
  return request({
    url: `/vod/view2/`,
    method: 'get',
    data
  })
}
//我的观看统计
export function myVideoView2(data) {
  return request({
    url: `/vod/view2/my/`,
    method: 'get',
    data
  })
}
//观看记录
export function viewItem(data) {
  return request({
    url: `/vod/viewitem/`,
    method: 'get',
    data
  })
}
//我的观看记录
export function myViewItem(data) {
  return request({
    url: `/vod/viewitem/my/`,
    method: 'get',
    data
  })
}
//更新观看记录
export function refreshViewItem(id, data) {
  return request({
    url: `/vod/viewitem/${id}/`,
    method: 'put',
    data
  })
}

//本视频的我的观看统计
export function myView(id) {
  return request({
    url: `/vod/video/${id}/my/`,
    method: 'get'
  })
}
//播放完成
export function viewItemComplete(id) {
  return request({
    url: `/vod/viewitem/${id}/complete/`,
    method: 'get'
  })
}


//单位观看量统计
export function groupByOrgView(data) {
  return request({
    url: '/vod/analyse/group_by_org_view/',
    method: 'post',
    data
  })
}
//个人观看量统计
export function groupByUserView(data) {
  return request({
    url: '/vod/analyse/group_by_user_view/',
    method: 'post',
    data
  })
}
//视频大类播放量统计
export function groupByCategoryView(data) {
  return request({
    url: '/vod/analyse/group_by_video_category_big/',
    method: 'post',
    data
  })
}