import request from '@/utils/request'

// 创建渠道管理
export function createChannel(data) {
  return request({
    url: '/ecw/channel/create',
    method: 'post',
    data: data
  })
}

// 更新渠道管理
export function updateChannel(data) {
  return request({
    url: '/ecw/channel/update',
    method: 'put',
    data: data
  })
}

// 删除渠道管理
export function deleteChannel(id) {
  return request({
    url: '/ecw/channel/delete?id=' + id,
    method: 'delete'
  })
}

// 获得渠道管理
export function getChannel(id) {
  return request({
    url: '/ecw/channel/get?channelId=' + id,
    method: 'get'
  })
}

// 获得渠道管理分页
export function getChannelPage(query) {
  return request({
    url: '/ecw/channel/page',
    method: 'get',
    params: query
  })
}

// 获得渠道列表 TODO
export function getChannelList(query) {
  return request({
    url: '/ecw/channel/select',
    method: 'get',
    params: query
  })
}

// 导出渠道管理 Excel
export function exportChannelExcel(query) {
  return request({
    url: '/ecw/channel/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
