import request from "@/utils/request";
import { AxiosPromise } from "axios";

/**
 * 获取登录日志分页
 * @param queryParams
 */
export function getLoginLogPage(
  queryParams: object
): AxiosPromise<PageResult<any[]>> {
  return request({
    url: "/api/v1/log/loginLog/page",
    method: "post",
    data: queryParams,
  });
}

/**
 * 获取操作日志分页
 * @param queryParams
 */
export function getOperaLogPage(
  queryParams: object
): AxiosPromise<PageResult<any[]>> {
  return request({
    url: "/api/v1/log/operLog/page",
    method: "post",
    data: queryParams,
  });
}

/**
 * 清空操作日志
 *
 * @param userId
 */
export function clearOperaLog(): AxiosPromise<any> {
  return request({
    url: "/api/v1/log/operLog/clear",
    method: "get",
  });
}
/**
 * 清空登录日志
 *
 * @param userId
 */
export function clearLoginLog(): AxiosPromise<any> {
  return request({
    url: "/api/v1/log/loginLog/clear",
    method: "get",
  });
}

/**
 * 删除登录日志
 *
 * @param ids
 */
export function deleteLoginLogs(ids: string[]) {
  return request({
    url: "/api/v1/log/loginLog/batch-del",
    method: "post",
    data: { ids: ids },
  });
}
/**
 * 删除操作日志
 *
 * @param ids
 */
export function deleteOperaLogs(ids: string[]) {
  return request({
    url: "/api/v1/log/operLog/batch-del",
    method: "post",
    data: { ids: ids },
  });
}
