import request from '@/utils/request' import type { PageResponse } from './user.api' import { NoticeStatus } from '@/constants/status' export interface LoginLog { id: number username: string ip: string location: string browser: string os: string status: number message: string loginTime: string } export interface LoginLogPageRequest { page: number size: number keyword?: string username?: string ip?: string } export interface OpLog { id: number operator: string description: string method: string url: string params: string ip: string status: number createdAt: string } export interface OpLogPageRequest { page: number size: number keyword?: string operator?: string } export interface ExLog { id: number url: string method: string message: string stackTrace: string ip: string operator: string createdAt: string } export interface ExLogPageRequest { page: number size: number keyword?: string } export interface Notice { id: number title: string content: string type: string status: NoticeStatus createdBy: string createdAt: string updatedAt: string } export interface CreateNoticeRequest { title: string content: string type?: string status?: NoticeStatus } export interface UpdateNoticeRequest { title?: string content?: string type?: string status?: NoticeStatus } export interface NoticePageRequest { page: number size: number title?: string type?: string status?: string } export const loginLogApi = { getLoginLogs: (params: LoginLogPageRequest) => request.get>('/logs/login/page', { params }), getOpLogs: (params: OpLogPageRequest) => request.get>('/logs/operation/page', { params }), getExLogs: (params: ExLogPageRequest) => request.get>('/logs/exception/page', { params }), } export const noticeApi = { getPage: (params: NoticePageRequest) => request.get>('/notice/page', { params }), getById: (id: number) => request.get(`/notice/${id}`), create: (data: CreateNoticeRequest) => request.post('/notice', data), update: (id: number, data: UpdateNoticeRequest) => request.put(`/notice/${id}`, data), delete: (id: number) => request.delete(`/notice/${id}`), }