import { request } from '@umijs/max';
import { downLoadXlsx } from '@/utils/downloadfile';

// 查询操作日志记录列表
export async function getMobileLogList(params?: API.Logs.MobilelogListParams) {
  return request<API.Logs.OperlogPageResult>('/api/cms/operlog/list', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    params
  });
}

// 修改操作日志记录
export async function updateMobilelog(params: API.Logs.Mobilelog) {
  return request<API.Result>('/api/cms/operlog', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params
  });
}
// 新增操作日志记录
export async function addMobilelog(params: API.Logs.Mobilelog) {
  return request<API.Result>('/api/cms/operlog', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params
  });
}

// 删除操作日志记录
export async function removeMobilelog(ids: string) {
  return request<API.Result>(`/api/cms/operlog/${ids}`, {
    method: 'DELETE'
  });
}

export function exportMobilelog(params?: API.Logs.OperlogListParams) {
  return downLoadXlsx(`/api/cms/operlog/export`, { params }, `operlog_${new Date().getTime()}.xlsx`);
}
