// @ts-ignore
/* eslint-disable */
import { request } from 'umi';
import { getAPIHost } from '../utils/utils';

const host = getAPIHost();

export async function consultantList(page: number, size: number) {
  const url = new URL('/api/v1/cms/listConsultant', host);
  url.searchParams.append('page', page.toString());
  url.searchParams.append('size', size.toString());
  return request<API.Response<API.Page<API.Consultant>>>(url.toString(), {
    method: 'POST',
  });
}

export async function consultantDetail(id: number) {
  const url = new URL('/api/v1/cms/consultantDetail', host);
  url.searchParams.append('id', id.toString());
  return request<API.Response<API.Consultant>>(url.toString(), {
    method: 'POST',
  });
}

export async function articleList(type: number, page: number, size: number) {
  const url = new URL('/api/v1/cms/listArticle', host);
  url.searchParams.append('type', type.toString());
  url.searchParams.append('page', page.toString());
  url.searchParams.append('size', size.toString());
  return request<API.Response<API.Page<API.Article>>>(url.toString(), {
    method: 'POST',
  });
}

export async function articleDetail(id: number) {
  const url = new URL('/api/v1/cms/articleDetail', host);
  url.searchParams.append('id', id.toString());
  return request<API.Response<API.Article>>(url.toString(), {
    method: 'POST',
  });
}
export async function listServiceProduct(page: number, size: number) {
  const url = new URL('/api/v1/cms/listServiceProduct', host);
  url.searchParams.append('page', page.toString());
  url.searchParams.append('size', size.toString());
  return request<API.Response<API.Page<API.services>>>(url.toString(), {
    method: 'POST',
  });
}
//获取客户声音列表
export async function listCustomer(page: number, size: number) {
  const url = new URL('/api/v1/cms/listCustomer', host);
  url.searchParams.append('page', page.toString());
  url.searchParams.append('size', size.toString());
  return request<API.Response<API.Page<API.customer>>>(url.toString(), {
    method: 'POST',
  });
}
//获取走近高潜列表
export async function listVideo(page: number, size: number) {
  const url = new URL('/api/v1/cms/listVideo', host);
  url.searchParams.append('page', page.toString());
  url.searchParams.append('size', size.toString());
  return request<API.Response<API.Page<API.Video>>>(url.toString(), {
    method: 'POST',
  });
}
