import { request } from '@@/plugin-request/request';
import { stringify } from 'qs';

/**
 * 查询文章列表
 * @param param
 */
export async function queryArticle(param: object) {
  return request(`/web/v1/articles?${stringify(param)}`);
}

/**
 * 新增栏目
 * @param params
 */
export async function createArticle(params: object) {
  return request(`/web/v1/articles`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 编辑栏目
 * @param params
 */
export async function editArticle(params: any) {
  return request(`/web/v1/articles/${params.record_id}`, {
    method: 'PUT',
    data: params,
  });
}

/**
 * 删除文章
 * @param record_id
 */
export async function delArticle(record_id: any) {
  return request(`/web/v1/articles/${record_id}`, {
    method: 'DELETE',
  });
}
