import { graphqlRequest } from '../config/api'
|
|
// Dashboard 指标查询
|
const GET_DASHBOARD_STATS_QUERY = `
|
query GetDashboardStats {
|
dashboardStats {
|
activeActivities
|
totalPlayers
|
pendingReviews
|
totalJudges
|
}
|
}
|
`
|
|
// 报名趋势统计
|
const GET_REGISTRATION_TREND_QUERY = `
|
query RegistrationTrend($days: Int) {
|
registrationTrend(days: $days) {
|
date
|
count
|
}
|
}
|
`
|
|
// 区域报名统计
|
const GET_REGION_REGISTRATION_STATS_QUERY = `
|
query RegistrationRegionStats {
|
registrationRegionStats {
|
regionId
|
regionName
|
leafFlag
|
count
|
}
|
}
|
`
|
|
export const getDashboardStats = async () => {
|
const result = await graphqlRequest(GET_DASHBOARD_STATS_QUERY)
|
return result.data.dashboardStats
|
}
|
|
export const getRegistrationTrend = async (days = 15) => {
|
const result = await graphqlRequest(GET_REGISTRATION_TREND_QUERY, { days })
|
return result.data.registrationTrend || []
|
}
|
|
export const getRegionRegistrationStats = async () => {
|
const result = await graphqlRequest(GET_REGION_REGISTRATION_STATS_QUERY)
|
return result.data.registrationRegionStats || []
|
}
|