import { http } from '@/utils/http/axios';

/**
 * @description: 文章列表
 */
export function articleList(params) {
  return http.request({
    url: '/article/list',
    method: 'get',
    params,
  });
}

/**
 * @description: 添加文章
 */
export function addArticle(params) {
  return http.request({
    url: '/article/add',
    method: 'post',
    params,
  });
}

/**
 * @description: 修改文章
 */
export function editArticle(params) {
  return http.request({
    url: '/article/update ',
    method: 'post',
    params,
  });
}

/**
 * @description: 文章信息
 */
export function articleInfo(params) {
  return http.request({
    url: '/article/info',
    method: 'get',
    params,
  });
}

/**
 * @description: 删除文章
 */
export function deleteArticle(data) {
  return http.request({
    url: '/article/delete ',
    method: 'post',
    data,
  });
}

/**
 * @description: 导出文章
 */
export function exportArticle(data?) {
  return http.request(
    {
      url: '/article/export',
      method: 'post',
      data,
      responseType: 'blob', // 二进制流
    },
    {
      isReturnNativeResponse: true,
    },
  );
}

/**
 * @description: 导入文章
 */
export function importArticle(data) {
  return http.request({
    url: '/article/import',
    method: 'post',
    data,
  });
}
