import { request } from 'umi';
import { stringify } from 'qs';

/**
 * 栏目列表数据查询
 * @param param
 */
export async function queryColumn(param: object) {
  return request(`/web/v1/columns?${stringify(param)}`);
}

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

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

/**
 * 删除栏目
 * @param record_id
 */
export async function delColumn(record_id: any) {
  return request(`/web/v1/columns/${record_id}`, {
    method: 'DELETE',
  });
}
