import request from '@/utils/request'

// 获取知识库
export function getKnowledgeBase() {
  return request({
    url: '/api/web/knowledgeBase',
    method: 'GET'
  })
}

// 添加知识库
export function createKnowledgeBase(data) {
  return request({
    url: `/api/web/knowledgeBase`,
    method: 'POST',
    data
  })
}

// 修改知识库
export function updateKnowledgeBase(data) {
  return request({
    url: `/api/web/knowledgeBase/${data.id}`,
    method: 'PUT',
    data
  })
}

// 获取知识库信息
export function getKnowledgeBaseInfo(id) {
  return request({
    url: `/api/web/knowledgeBase/${id}`,
    method: 'GET'
  })
}

// 删除知识库
export function delKnowledgeBase(id) {
  return request({
    url: `/api/web/knowledgeBase/${id}`,
    method: 'DELETE'
  })
}

// 获取知识列表
export function getKnowledgeList(data) {
  return request({
    url: `/api/web/knowledge`,
    method: 'POST',
    data
  })
}

// 获取知识信息
export function getKnowledgeInfo(id) {
  return request({
    url: `/api/web/knowledge/${id}`,
    method: 'GET'
  })
}

// 删除知识信息
export function delKnowledge(id) {
  return request({
    url: `/api/web/knowledge/${id}`,
    method: 'DELETE'
  })
}

// 审核知识信息
export function audit(id) {
  return request({
    url: `/api/web/knowledge/audit?id=${id}`,
    method: 'GET'
  })
}
