fix(admin): 优化聊天日志报表
This commit is contained in:
1 parent
c38a56536e
commit
757231e3d5
14 files changed
+584
-108
No files matched your search
@@ -7,6 +7,7 @@ import { requestJson } from '@/shared/api/client';
|
||||
import type { AdminUserRow } from '../types/admin.types';
|
||||
import type { AdminDashboardBadges, AdminDashboardSummary } from '../types/dashboard.types';
|
||||
import type { PaginatedResult } from '@/shared/types/pagination.types';
|
||||
import type { UsageReport } from '../types/report.types';
|
||||
|
||||
const auth = () => ({ headers: getAuthHeaders() });
|
||||
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
|
||||
@@ -161,7 +162,21 @@ export const getAdminDashboardBadges = () =>
|
||||
requestJson<AdminDashboardBadges>('/api/admin/dashboard/badges', auth());
|
||||
|
||||
// Reports
|
||||
export const getAdminUsageReport = () => requestJson<any>('/api/admin/reports/usage', auth());
|
||||
export interface AdminUsageReportParams {
|
||||
user_page?: number;
|
||||
user_page_size?: number;
|
||||
}
|
||||
|
||||
export const getAdminUsageReport = (params: AdminUsageReportParams = {}) => {
|
||||
const qs = new URLSearchParams();
|
||||
if (params.user_page != null) qs.set('user_page', String(params.user_page));
|
||||
if (params.user_page_size != null) qs.set('user_page_size', String(params.user_page_size));
|
||||
const query = qs.toString();
|
||||
return requestJson<UsageReport>(
|
||||
`/api/admin/reports/usage${query ? `?${query}` : ''}`,
|
||||
auth(),
|
||||
);
|
||||
};
|
||||
export const getAdminFeedbackReport = () => requestJson<any>('/api/admin/reports/feedback', auth());
|
||||
export const getAdminReportTable = (url: string) => requestJson<any[]>(url, auth());
|
||||
export const getAdminReportTableCount = (url: string) => requestJson<{ total: number }>(url, auth());
|
||||
|
||||
Reference in new issue
Block a user