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 getSystemLogininforList = (query?: object) => {
  return http.request<operlogList>(
    "get",
    baseUrlApi("system/logininfor/list"),
    {
      params: query
    }
  );
};

/**
 * 删除登录日志
 * @param id
 */
export const deleteSystemLogininfor = (id: string) => {
  return http.request<BasicResponseModel>(
    "delete",
    baseUrlApi(`system/logininfor/${id}`)
  );
};

/**
 * 清空登录日志
 */
export const cleanSystemLogininfor = () => {
  return http.request<BasicResponseModel>(
    "delete",
    baseUrlApi("system/logininfor/clean")
  );
};
