import request from '@/utils/request'

export function getArticleList(query) {
  return request({
    url: '/cms/article/',
    method: 'get',
    params:query
  })
}
export function createArticle(data) {
  return request({
    url: '/cms/article/',
    method: 'post',
    data
  })
}
export function updateArticle(id, data) {
  return request({
    url: `/cms/article/${id}/`,
    method: 'put',
    data
  })
}
export function deleteArticle(id) {
  return request({
    url: `/cms/article/${id}/`,
    method: 'delete',
  })
}
export function getArticle(id) {
  return request({
    url: `/cms/article/${id}/`,
    method: 'get',
  })
}
export function topArticle(id) {
  return request({
    url: `/cms/article/${id}/top/`,
    method: 'put',
  })
}

export function getMaterialList(query) {
  return request({
    url: '/cms/material/',
    method: 'get',
    params:query
  })
}
export function createMaterial(data) {
  return request({
    url: '/cms/material/',
    method: 'post',
    data
  })
}
export function updateMaterial(id, data) {
  return request({
    url: `/cms/material/${id}/`,
    method: 'put',
    data
  })
}
export function deleteMaterial(id) {
  return request({
    url: `/cms/material/${id}/`,
    method: 'delete',
  })
}