合作页面的内容

This commit is contained in:
李琦
2026-01-16 10:19:30 +08:00
parent 3bcef22487
commit de821a8645
18 changed files with 1018 additions and 237 deletions

View File

@@ -734,16 +734,23 @@ export interface RecentActivity {
}
// 仪表盘API
export const getDashboardStats = async (): Promise<DashboardStats> => {
export const getDashboardStats = async (startDate?: string, endDate?: string): Promise<DashboardStats> => {
try {
const response = await fetch(`${API_BASE}/admin/dashboard/stats`, {
let url = `${API_BASE}/admin/dashboard/stats`
const params = new URLSearchParams()
if (startDate) params.append('startDate', startDate)
if (endDate) params.append('endDate', endDate)
if (params.toString()) url += `?${params.toString()}`
const response = await fetch(url, {
headers: getAuthHeaders()
})
if (!response.ok) {
const errorData = await response.json()
throw new Error(errorData.error || '获取仪表盘统计数据失败')
}
return await response.json()
const data = await response.json()
return data.result // 适配新的统一响应结构
} catch (error) {
console.error('Get dashboard stats error:', error)
throw error