import { request } from '/@/utils/service';


const apiPrefix = '/api/choice/';

export function getTableData(query: any) {
  return request({
    url: apiPrefix + 'reviews_monitor/',
    method: 'GET',
    params: query
  });
}

export function createProductMonitor(body: any) {
  return request({
    url: '/api/choice/reviews_monitor/',
    method: 'POST',
    data: body
  });
}

export function getGroupOptions(query: any) {
  return request({
    url: apiPrefix + 'goods/tags/',
    method: 'GET',
    params: query
  });
}

export function getBrandsOptions(query: any) {
  return request({
    url: apiPrefix + 'goods/brands/',
    method: 'GET',
    params: query
  });
}

export function getShopsOptions(query: any) {
  return request({
    url: apiPrefix + 'marketplace_shops/select/',
    method: 'GET',
    params: query
  });
}

export function updateRow(body: any) {
  return request({
    url: apiPrefix + `reviews_monitor/${body.id}/` ,
    method: 'PUT',
    params: { partial: 1 },
    data: body
  });
}

export function deleteRow(body: any) {
  return request({
    url: apiPrefix + `reviews_monitor/${body.id}/` ,
    method: 'DELETE',
    data: body
  });
}

export function batchDeleteRow(body: any) {
  return request({
    url: apiPrefix + 'reviews_monitor/multiple_delete/',
    method: 'DELETE',
    data: body
  });
}

// 导入
export function upload(body: any){
  return request({
    url: apiPrefix +'reviews_monitor/import_data/',
    method: 'POST',
    data: body,
  });
}

// 导出
export function exportData(query: any) {
  return request({
    url: apiPrefix +'reviews_monitor/export_data/',
    method: 'GET',
    params: query,
    responseType: 'blob'
  });
}
