import request from '@/utils/request'

// 查询分类列表
export function listCategory(query) {
  return request({
    url: '/back/category/list',
    method: 'get',
    params: query
  })
}

// 查询分类详细
export function getCategory(id) {
  return request({
    url: '/back/category/' + id,
    method: 'get'
  })
}

// 新增分类
export function addCategory(data) {
  return request({
    url: '/back/category',
    method: 'post',
    data: {
      name: data.name,
      backImg: data.backImg
    },
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

// 修改分类
export function updateCategory(data) {
  return request({
    url: '/back/category',
    method: 'put',
    data: {
      id: data.id,
      name: data.name,
      backImg: data.backImg
    },
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

// 删除分类
export function delCategory(id) {
  return request({
    url: '/back/category/' + id,
    method: 'delete'
  })
} 