import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { OperationRecord, OperationRecordParam } from './model';

/**
 * 分页查询操作日志
 */
export async function pageOperationRecords(params: OperationRecordParam) {
  const res = await request.get<ApiResult<PageResult<OperationRecord>>>(
    '/system/operate-record/page',
    { params }
  );
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
