feat: add notify icon read

This commit is contained in:
engigu
2026-03-09 18:10:23 +08:00
parent e7da316c90
commit 77cf12c9b6
46 changed files with 1347 additions and 252 deletions
+50
View File
@@ -287,6 +287,20 @@ export const api = {
deleteBinding: (id: string) => request('/notify/bindings/' + id, { method: 'DELETE' }),
send: (data: { channel_id: string; title: string; text: string }) =>
request<NotifyResult>('/notify/send', { method: 'POST', body: JSON.stringify(data) })
},
appLogs: {
list: (params?: { page?: number; page_size?: number; category?: string; status?: string; level?: string; keyword?: string }) => {
const query = new URLSearchParams()
if (params?.page) query.set('page', String(params.page))
if (params?.page_size) query.set('page_size', String(params.page_size))
if (params?.category) query.set('category', params.category)
if (params?.status) query.set('status', params.status)
if (params?.level) query.set('level', params.level)
if (params?.keyword) query.set('keyword', params.keyword)
return request<AppLogListResponse>(`/app-logs?${query}`)
},
markAsRead: (data: { id?: string; category?: string }) => request('/app-logs/read', { method: 'POST', body: JSON.stringify(data) }),
clear: (category: string) => request('/app-logs/clear', { method: 'POST', body: JSON.stringify({ category }) })
}
}
@@ -561,4 +575,40 @@ export interface NotifyResult {
error?: string
}
export interface AppLog {
id: string
category: string
title: string
content: string
level: string
status: string
ref_id: string
error_msg: string
created_at: string
read_at: string | null
}
export interface AppLogListResponse {
data: AppLog[]
total: number
}
export const LOG_CATEGORY = {
SYSTEM_NOTICE: 'system_notice',
PUSH_LOG: 'push_log'
} as const
export const LOG_LEVEL = {
INFO: 'info',
WARNING: 'warning',
ERROR: 'error'
} as const
export const LOG_STATUS = {
UNREAD: 'unread',
READ: 'read',
SUCCESS: 'success',
FAILED: 'failed'
} as const