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'
  })
}

export function getSourceList(query) {
  return request({
    url: '/cms/source/',
    method: 'get',
    params:query
  })
}
export function createSource(data) {
  return request({
    url: '/cms/source/',
    method: 'post',
    data
  })
}
export function updateSource(id, data) {
  return request({
    url: `/cms/source/${id}/`,
    method: 'put',
    data
  })
}
export function deleteSource(id) {
  return request({
    url: `/cms/source/${id}/`,
    method: 'delete'
  })
}

export function getThresholdList(query) {
  return request({
    url: '/cms/threshold/',
    method: 'get',
    params:query
  })
}
export function createThreshold(data) {
  return request({
    url: '/cms/threshold/',
    method: 'post',
    data
  })
}
export function updateThreshold(id, data) {
  return request({
    url: `/cms/threshold/${id}/`,
    method: 'put',
    data
  })
}
export function deleteThreshold(id) {
  return request({
    url: `/cms/threshold/${id}/`,
    method: 'delete'
  })
}
