import { http } from "@/utils/http";
import { baseUrlApi } from "../utils";

export interface operlogList<T = any> {
  code: number;
  msg: string;
  rows: T;
  total?: number;
}

export interface BasicResponseModel<T = any> {
  code: number;
  msg: string;
  data: T;
}

/**
 * 获取操作日志列表
 * @param query
 */
export const getSystemOperlogList = (query?: object) => {
  return http.request<operlogList>("get", baseUrlApi("system/operlog/list"), {
    params: query
  });
};

/**
 * 删除操作日志
 * @param ids
 */
export const deleteSystemOperlog = (ids: string) => {
  return http.request<BasicResponseModel>(
    "delete",
    baseUrlApi(`system/operlog/${ids}`)
  );
};

/**
 * 清空操作日志
 */
export const cleanSystemOperlog = () => {
  return http.request<BasicResponseModel>(
    "delete",
    baseUrlApi("system/operlog/clean")
  );
};
