import request from '@/utils/request'

// 查询
export function list(data) {
  return request({
    url: '/api/study/findAllInfo',
    method: 'post',
    data: data
  })
}
export function listByTitle(data) {
  return request({
    url: '/api/study/findInfoByTitle',
    method: 'post',
    data: data
  })
}


// 查询
export function getDetail(configId) {
  return request({
    url: '/system/config/' + configId,
    method: 'get'
  })
}

// 查询
export function getConfigKey(configKey) {
  return request({
    url: '/system/config/configKey/' + configKey,
    method: 'get'
  })
}

// 新增
export function add(data) {
  return request({
    url: '/api/study/saveDoc',
    method: 'post',
    data: data
  })
}

// 修改
export function update(data) {
  return request({
    url: '/api/study/updateDocByDocId',
    method: 'post',
    data: data
  })
}

export function updateViewNum(data) {
  return request({
    url: '/api/study/updatePageViewNumById',
    method: 'post',
    data: data
  })
}
export function addViewNum(data) {
  return request({
    url: '/api/study/saveViewLog',
    method: 'post',
    data: data
  })
}
export function findDocInfoById(data) {
  return request({
    url: '/api/study/findDocInfoById',
    method: 'post',
    data: data
  })
}

// 删除
export function del(data) {
  return request({
    url: '/api/study/deleteById',
    method: 'post',
    data: data
  })
}

// 刷新
export function refreshCache() {
  return request({
    url: '/system/config/refreshCache',
    method: 'delete'
  })
}
export function listByDictType(study_datasource_type) {
  return request({
    url: '/system/dict/data/listByDictType?dictType='+study_datasource_type+'&status=0',
    method: 'get'
  })
}
