import request from '@/utils/request'

// 查询列表学习资料
export function listMaterials(query) {
  return request({
    url: '/core/materials/list',
    method: 'get',
    params: query
  })
}

//设置为公开或者非公开
export function editOpen(id, isOpen) {
  return request({
    url: '/core/materials/' + id + "/" + isOpen,
    method: 'get'
  })
}

// 查询详细学习资料
export function getMaterials(id) {
  return request({
    url: '/core/materials/' + id,
    method: 'get'
  })
}

// 新增学习资料
export function addMaterials(data) {
  return request({
    url: '/core/materials',
    method: 'post',
    data: data
  })
}

// 修改学习资料
export function updateMaterials(data) {
  return request({
    url: '/core/materials',
    method: 'put',
    data: data
  })
}

// 删除学习资料
export function delMaterials(id) {
  return request({
    url: '/core/materials/' + id,
    method: 'delete'
  })
}
